Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Add getEndpoint and setEndpoint methods to the MailgunTransport class #29312

Merged
merged 2 commits into from
Jul 29, 2019

Conversation

SerhiiStarovoitov
Copy link
Contributor

@SerhiiStarovoitov SerhiiStarovoitov commented Jul 28, 2019

If you need to switch (on the fly) your mailgun domain while sending emails you can do it by updating the MailgunTransport "domain" property using the setDomain() method. But if your mailgun domain region is EU, you should also change the endpoint property value from "api.mailgun.net" to "api.eu.mailgun.net".

This PR adds setEndpoint method to MailgunTransport class, so you can do it like this (in your Mailable-class, for example):

$mailTransport = app()->make('mailer')->getSwiftMailer()->getTransport();
$mailTransport->setDomain('yourdomain.com');
$mailTransport->setEndpoint('api.eu.mailgun.net');

* @param string $endpoint
* @return string
*/
public function setEndpoint($endpoint)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a setter method should return void or $this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but all the other setter methods (key and domain) return the property value, so I left it the same for the endpoint setter.

@GrahamCampbell GrahamCampbell changed the title Add getEndpoint and setEndpoint methods to the MailgunTransport class [5.8] Add getEndpoint and setEndpoint methods to the MailgunTransport class Jul 28, 2019
@taylorotwell taylorotwell merged commit 0c3d547 into laravel:5.8 Jul 29, 2019
Copy link
Contributor Author

@SerhiiStarovoitov SerhiiStarovoitov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more typo: #29329

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.

3 participants