Skip to content

[9.x] Add raw content property for mailables#44703

Merged
taylorotwell merged 4 commits into
laravel:9.xfrom
Xammie:raw-email-content
Oct 25, 2022
Merged

[9.x] Add raw content property for mailables#44703
taylorotwell merged 4 commits into
laravel:9.xfrom
Xammie:raw-email-content

Conversation

@Xammie
Copy link
Copy Markdown
Contributor

@Xammie Xammie commented Oct 24, 2022

This is a follow up from #44696 (comment).

This PR introduces a new property and method on the mailable content class to supply a raw html string.

public function content() {
    return new Content(
        raw: 'raw html string'
    );
}

The classic mailable approach already has this feature.

public function build() {
    return $this->html('raw html string');
}

Comment thread src/Illuminate/Mail/Mailables/Content.php Outdated
@driesvints driesvints marked this pull request as draft October 24, 2022 09:26
@driesvints
Copy link
Copy Markdown
Member

Hi there. We fixed the failing tests on 9.x which are causing this PR to fail as well. Can you please rebase your PR with 9.x and mark this PR as ready for review when all tests are passing again? Thanks

@Xammie Xammie marked this pull request as ready for review October 24, 2022 10:23
@kieranmetcalfe
Copy link
Copy Markdown

Are there plans for a rawText() method at all?

I'm using soundasleep/html2Text to convert my HTML view to text-only, and it would be great to be able to pass that value into the Content. At the moment I can fudge it by passing the text via a blade, but it's a bit clunky...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants