How to setup a outgoing mail smtp server like smtp.gmail.com?

January 25, 2015 4.3k views

Hi Good day!

I have LEMP installed on my Droplet and I want it to be my web and mail server at the same time, I have installed postfix, dovecot in it and it works fine.

My objective is to create an SMTP server (smtp.mydomain.com) and use it to gmail as outgoing mail.

Any steps or tutorial of how can I setup my own SMTP server?

Thanks in advance

1 Answer

Well, you said that you've already created your own SMTP server. What would you like to know? How you could build a smtp server which will use GMAIL as relay server?

There are plenty of tutorials out there. The most important thing is to configure your postfix in the right way.

  • Thank you for your response jay986365

    Yeah, postfix and dovecot I have installed already and its working but I want "smtp.mydomain.com" so that I can use it to my gmail account. :D

  • I have tried relay server of gmail already and it's not working, I think relay server is for those who want their own webmail and relay to gmail smtp server. In my case I want my own smtp.mydomain.com like gmail smtp server which is smtp.gmail.com because gmail had provided an option to put your own smtp.domain.com.

  • So what u want, is using smtp.yourdomain.com as hostname?

  • Yeah, hostname the right word to describe, I want to setup my own smtp email server host along with my web server.

  • Oh well, that's possible. Step 1 is configuring your DNS settings of your domain name. There you should create an A record pointing to the IP of your DigitalOcean Droplet which will serve as a mailserver.

    The second step is configuring the /etc/hosts file in your Droplet.

  • Thank you for your response jay986365. Will try that one. :D

Have another answer? Share your knowledge.