Question

Send email through SMTP on nginx for a multi-site droplet?

Posted June 10, 2016 12.5k views
UbuntuPHPWordPressEmailLinux Commands

Hey there, I’m passing a hard time configuring mail on nginx. Hope someone could help me. Sorry if it looks dumb but I’m coming for another host provider which has some settings by default.

So, I have a droplet which hosts several websites. They’re mainly in WordPress. The thing I like to do is enable all of them to send emails, so they can receive one from WP when they lost their password, their websites could have a contact form, etc.

I tried all day long (seriously) a way to configure stuff like sendmail, msmtp and alike with no success. I can’t telnet Google on any port (was trying to configure GMail for this) and none of the default tutorials related to PHP mail() function has worked.

It seems to me a concern related to domain names. But since my droplet hosts several websites, I just don’t know what I have to put on my hosts file. It actually have

127.0.0.1 localhost mydropletname mydropletname

whereas mydropletname is the name it appears when I type hostname.

Currently the last log error from my sendmail log file is

Deferred: Connection timed out with alt4.aspmx.l.google.com.

sendmail is configured with default for everything (just hitted YES for all).

I’m desperate. Filling the gap for a colleage that went ouf of our company and I’m pretty new to it. Appreciate any help.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @tokiBano,

I’m not sure what version of Ubuntu you’re using, but this should apply to all of them. Give this a shot, and let us know how it goes:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-16-04

by finid
Postfix is a *mail transfer agent* (MTA), an application used to send and receive email. In this tutorial, we will install and configure Postfix so that it can be used to send emails by local applications only — that is, those installed on the same server that Postfix is installed on.
Submit an Answer