Create an SMTP Server on Oracle Cloud for Free



Create an Oracle always free account at https://www.oracle.com/cloud/free/  
This will create an Oracle Cloud tenancy for you. 
Once you have your account create a VM instance using this quick action. that guides you to create the instances and how to do ssh to it.

Once you have your instances just run the following commands:



#install sendemail
yum install sendmail
#configure email to allow send emails other than localhost
vi /etc/mail/sendmail.mc
# change from
#DAEMON_OPTIONS(`Port=smtp, Addr=127.0.0.1 Name=MTA’)dnl
# to
#DAEMON_OPTIONS(`Port=smtp, Name=MTA’)dnl
#open default smtp port on the firewall
firewall-cmd --zone=public --add-port=25/tcp --permanent
firewall-cmd --reload
#start the service
service sendmail restart
view raw smtpOnCloud.sh hosted with ❤ by GitHub
Now open the port on Oracle Cloud, this is done by creating and Ingress rule on your instance VirtualCloudNetwork as follows:

If all is ok, you will be able to send an email from the server with 

echo "Test Email using Oracle Cloud" | sudo sendmail example@gmail.com


To avoid your email going to spam you can configure a DNS for your server.

This post does guide you to all the steps to configure a custom domain for your server and much more https://www.unixmen.com/configuring-sendmail-smtp-server-on-centos-a-scientific-linux/  this is not specific to oracle cloud.



Comments