Skip to content

Mailgun multi domain support #46404

Closed
Closed
@joelharkes

Description

@joelharkes

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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions