How can I send email using my domain, firstname.lastname@example.org?
Assuming I have my email system setup with my domain registrar, how do I send email from my Linode as if it was coming from my domain?
There are three parts to this answer. The first part talks about ways to send your message and some software which can be used the second part demonstrates a method using
ssmtp and how to install it if you don't have it already.
Popular ways of sending your message
You can send mail through an email server somewhere else that is setup to use your domain. We will be discussing this method primarily.
You can send email directly to the email server of the recipient. Later we will talk about some caveats necessary to use this method.
You can send email through an email relay
Popular programs you can use
There are many different programs available to send your message to your email provider.
sendmailis one of the older and more reliable programs to send mail, it is very popular but gets more complicated and prone to security issues when used to accept mail from other hosts to relay those messages to other systems. It is required by many other mail programs to do the heavy lifting of sending the mail.
muttis an email client that uses a text based interface. It can be configured to be used on the command line to send email to and from a remote server
ssmtpis a program to simply send messages via SMTP. We will talk about installing and using this one.
If you are using Debian/Ubuntu distribution:
apt-get update && apt-get upgrade apt-get install ssmtp
yum update yum install epel-release yum install ssmtp
For all the options, query the manual page for this configuration file:
man 5 ssmtp.conf
Once you know what options you want, edit your /etc/ssmtp/ssmtp.conf file: (this is what we would want to use a on a Debian system for an email server setup that uses TLS)
email@example.com mailhub=smtp.example.com:587 UseTLS=YES UseSTARTTLS=YES AuthPass=My#Secrit!C0de AuthUserfirstname.lastname@example.org AuthMethod=LOGIN TLSCert=/etc/ssl/certs/ca-certificates.crt
You will want to tailor this to match your email server.
Once you have this done you can test it:
Subject: Testing email Email TESTING 1.2.3… 4.5.6… ^d