How can I send email using my domain, myaddress@example.com?

Linode Staff

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?

1 Reply

Overview

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

  1. You can send mail through an email server somewhere else that is setup to use your domain. We will be discussing this method primarily.

  2. You can send email directly to the email server of the recipient. Later we will talk about some caveats necessary to use this method.

  3. 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.

  • sendmail is 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.

  • mail is a simple command line program that simplifies using sendmail to send messages. It also lets you have local mailboxes on your system but it relies on having sendmail configured.

  • mutt is 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

  • ssmtp is a program to simply send messages via SMTP. We will talk about installing and using this one.

Installing ssmtp

If you are using Debian/Ubuntu distribution:

apt-get update && apt-get upgrade apt-get install ssmtp

On CentOS

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)

root=myaddress@example.com mailhub=smtp.example.com:587 UseTLS=YES UseSTARTTLS=YES AuthPass=My#Secrit!C0de AuthUser=myaddress@example.com 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:

ssmtp someuser@example.com

Subject: Testing email Email TESTING 1.2.3… 4.5.6… ^d

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct