Basic Email Sending with Linux
-
Sending email directly from Linux is super, duper simple. In this example, we will use Fedora 27 which is actually one of the hardest Linux editions to use for email because the underlying components are not included by default on their server installs like they used to be. In order to send email from any system, we need two components: an MTA (the email server that sends email out using the SMTP protocol) and an email client (the thing that actually tells the MTA to send a message.) This is the same for any OS, nothing unique to Linux. Linux just makes this all SO easy.
First let's install our two components. On Linux, postfix has come out as the clear MTA favourite over the last few decades. You can use others if you want, like sendmail, but postfix is the most commonly used, easiest to use, most often included by default for distros where you don't need to add it, etc. Then we will use mailx which gives us the "mail" command that allows us to actually tell postfix what to send.
On Fedora using the dnf command we just need this...
dnf -y install postfix mailx
Now it is easy to forget that the MTA is a service, not an "as needed" application. So we just need to kick it off so that it is running.
systemctl start postfix
Now we are literally all set and can email ourselves from our system! Seriously, that's all that is required. It's that easy on Linux. No third party software and zero configuration. It "Just works".
Here is a sample command to send your first email....
echo "This is my email message" | mail -s "This is my email subject" [email protected]
Now if you want postfix to run all of the time, you'll want to set it to start automatically to make this easier in the future.
systemctl enable postfix
Linux.... simple and effective.
-
I'd love a Zimbra install guide
-
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
-
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
oh FFS I went through this with you the other day..
I assume this thread is a response to a private conversation you had with @scottalanmiller after your failure to get email from your
dnf-automatic
setup.Start a thread to discuss that if you want, I am not going to clutter this thread with anymore replies regarding this.
-
Where is my "so salty" meme?
-
@wirestyle22 said in Basic Email Sending with Linux:
I'd love a Zimbra install guide
Here you go...
https://mangolassi.it/topic/8344/installing-zimbra-email-8-6-on-centos-7
-
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
Yes, otherwise how will you send out the email as the client needs to communicate over the network and postfix is what provides the network protocol. The mailx command doesn't have a network component, it just drops files into the postfix local queue.
-
@scottalanmiller said in Basic Email Sending with Linux:
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
Yes, otherwise how will you send out the email as the client needs to communicate over the network and postfix is what provides the network protocol. The mailx command doesn't have a network component, it just drops files into the postfix local queue.
Correct answer to his incorrectly worded question.
The correct answer to him is no.
-
@jaredbusch said in Basic Email Sending with Linux:
@scottalanmiller said in Basic Email Sending with Linux:
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
Yes, otherwise how will you send out the email as the client needs to communicate over the network and postfix is what provides the network protocol. The mailx command doesn't have a network component, it just drops files into the postfix local queue.
Correct answer to his incorrectly worded question.
The correct answer to him is no.
LOL
-
If your email is hosted through somewhere else, such as O365, you'll need to edit your SPF record to allow emails from that server or use an SMTP server that authenticates with and relays to O365.
DNF-Automatic, for example, from what I've seen, does not have SMTP authentication options. So I've been using an SMTP server.
-
@tim_g said in Basic Email Sending with Linux:
If your email is hosted through somewhere else, such as O365, you'll need to edit your SPF record to allow emails from that server or use an SMTP server that authenticates with and relays to O365.
DNF-Automatic, for example, from what I've seen, does not have SMTP authentication options. So I've been using an SMTP server.
O365 has options for IP authenticated relay (but I think it's only to your own domains, it won't relay through O365 to other domains - again I think).
-
@jaredbusch said in Basic Email Sending with Linux:
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
oh FFS I went through this with you the other day..
I assume this thread is a response to a private conversation you had with @scottalanmiller after your failure to get email from your
dnf-automatic
setup.Start a thread to discuss that if you want, I am not going to clutter this thread with anymore replies regarding this.
-
@dashrender said in Basic Email Sending with Linux:
@jaredbusch said in Basic Email Sending with Linux:
@brrabill said in Basic Email Sending with Linux:
If you have multiple servers on a network, do you install postfix on each one? Or just set up one? What's YOUR best practice there?
oh FFS I went through this with you the other day..
I assume this thread is a response to a private conversation you had with @scottalanmiller after your failure to get email from your
dnf-automatic
setup.Start a thread to discuss that if you want, I am not going to clutter this thread with anymore replies regarding this.
hahahahahahahahaha
got em
-
@JaredBusch before this post
@JaredBusch after this post