Closed
Description
Description
currently sending mails via mailgun via different domains is not supported because the domain
is hardcoded.
as a SaaS application we would like to send from different domains for our different brands.
I have a solution but sadly the property needed domain
is private instead of protected
.
Example
code below could work as an adaption if not the domain
property was private.
alternatively add this to the
class MailgunMultiDomainHttpTransport extends MailgunHttpTransport {
protected function doSendHttp(SentMessage $message): ResponseInterface
{
$sender = $message->getEnvelope()->getSender();
$fromEmail = $sender->getAddress();
if ($fromEmail) {
$this->domain = substr($fromEmail, strpos($fromEmail, '@') + 1);
}
return parent::doSendHttp($message);
}
}