Closed lwestfall closed 2 months ago
Found some free time today to take a stab - I think it was pretty easy (basically just swapping the null coalescing precedence on what was this._globalFrom ?? @from
).
Issue I'm having is writing tests:
Mailable._from
being private. SmtpMailer.RenderAsync
returns a string with just the razor page rendered as html, so can't find the From address in thereI'm assuming we want tests for at least SmtpMailer or FileLogMailer (if not both). Here are a few options as I see them, not mutually exclusive:
Mailable._from
(or could mark field or getter internal and make internal members visible to the test assembly if we want to keep _from invisible to client assemblies)Hope this all makes sense, let me know if you have any suggestions.
Thanks for looking into this.
I'm okay with adding some public getters, as long as we keep the setters private. Notably, for the SMTP Mailer this is needed for the tests to work.
For the FileLogMailer, if you want to check the headers that would work 👍
I'm indifferent about the AssertMailer since it's more-or-less a testing tool vs. production thing.
Let me know if there's anything that I missed, etc. Thanks!
This is fixed in Mailer 6.0.0. https://docs.coravel.net/Mailing/#sender
Describe the solution you'd like Calling
.From("someone@somewhere.com")
inBuild()
doesn't seem to override the globalFrom address. As discussed in #320 it's better if calling.From()
would override the globalFrom mailbox. Essentially this would mean that globalFrom acts more as a default from address that can easily be overridden conditionally or on a Mailable implementation basis.I can work on this one and #320 together. Might be a couple of days before I get to it.