Mailgun sandbox account and cloudways SMTP control panel

I’ve been going back and forth with support via ticket system, but the feedback hasn’t been very helpful, so I’m trying here hoping someone might have ran into the same situation before…

I have a digital ocean server with a few “custom php” apps that use php mail() to send transactional email.

I want to setup Mailgun for SMTP relay, but since the server is hosting multiple websites and I can’t use multiple Mailgun credentials per server, I’m assuming I should use the sandbox account Mailgun provides (and the cloudways blog post on SMTP setup seems to corroborate
that in their screenshots). Unfortunately, the SMTP login credentials on Mailgun for this “sandbox” is something crazy like: and cloudways has a 60 character limit validation in their control panel to setup SMTP. (why???)

Because customer support was taking more than their SLA time to respond to my questions, I setup Sendgrid instead (you just have to enter the account login instead of the SMTP creds in cloudways control panel for this provider) in the meantime, and it’s working fine.

But now I’m having a hard time switching from Sendgrid to Mailgun because tech support says they have to do it manually and won’t give me an exact time, so I can’t be around to make sure everything transitions correctly and email forms still work throughout the switch.

Anyone has setup Mailgun with another account than the default sandbox on a server to send emails from multiple sites? If so, did it impact your delivery in any ways? How did you set that up?

Thanks for any pointers in the right direction!

I’ve tried to get those answers from tech support, but they’ve been very terse and generally unhelpful, answering vaguely or just straight up ignoring some of my questions, and it takes minimum 24 hours every times I try to get some clarification…

I’m not sure I can completely answer all your questions but maybe some.
First I am not sure why you want to switch back from Sendgrid to Mailgun. I have tried Mailgun and the shared ip I have will not deliver any email to yahoo addresses as it is blacklisted and mailgun has not stated to me they will do anything about it. So I am thinking I may switch to Sendgrid since at this time I am not going to pay for a dedicated ip.

I don’t use mailgun’s sandbox.
I don’t use the server smtp setting as unless you setup code to sweep it it can take up to 90 minutes to deliver mail from there. I use an smtp plugin in each wordpress app.
I set up mailgun routes to forward email that gets sent from wordpress.
So I have one mailgun account and so far three different domains and wordpress apps which send mail through it. I had to setup the custom DNS entries in my domain’s record including MX and other records. Mailgun tells you how to set it up but if you’re not used to doing it then it can be confusing at first. Mailgun support more or less helped me through that.

Maybe this will also help:

Thanks for the feedback!

I want to switch to Mailgun mostly because the free option with Sendgrid is limited to 100/month.

Maybe I’ll download the WP plugin and look at how they do it. That might help me figure out how to set it up in my custom php apps.

As a side note: Yahoo rejected all the emails sent via Sendgrid too. I contacted Sendgrid support and they told me their free accounts share low quality IPs. They move you up to better ones as your reputation builds up supposedly. But you start at the bottom. Gmail and other providers delivered the emails from the same forms just fine. So Yahoo is pretty hard core across the board it seems…

Hi yann!

Here are a couple posts about configuring the mail() function to use an external host and SMTP credentials. It looks like each you’ll have to update the code in each of the apps with the specifics, so you don’t have to worry about server-wide config taking over like when using the Cloudways SMTP addon.

Hope this helps!

1 Like

It definitely helps! I’m gonna code up a PHPMailer + Mailgun implementation this weekend. I didn’t realize there’s a simple code solution instead of having to deal with the server directly (I’m more of a JavaScript guy… Not so much PHP). Seems like the easier solution!


It seems there may be some concerns regarding the use of a shared IP at mailgun. If that ESP does not end up working out for you, another ESP with a great fremium tier is MailJet. They also have a great drag/drop builder to make awesome responsive emails and API-based send that allows you to merge custom data into those templates, effectively separating the mailer code from the email design. You can update your messages in the MailJet builder independent of the server code that initiates the mail sending.

1 Like