Send mail to SMTP server on same LAN from CLI (confused with Mutt and Postfix)

muttpostfix

I need to send mail from CLI (Cron) to a mail server that is on the same LAN. After some googling Mutt seemed like a good option as it appeared simply installing Mutt and adding SMTP options to .muttrc would do the trick.

So I installed Mutt but the first thing that confused is that during setup it started Postfix. After some more reading I understand Mutt is supposed to only view email, but looking at config examples I'm not sure if I can point Mutt directly at my mail server or need to use and configure Postfix as well.

Another issue is that muttrc doesn't exist. I can only find Muttrc in /etc/ but that file doesn't look similar to config files I found online.

My questions are:

  • Do I need to use Postfix or can I simply configure Mutt with the IP of my SMTP server?

  • Why is muttrc not located in the home folder? Can I create it myself?

I'm using Ubuntu 16.04

Best Answer

  1. You don't need postfix on your machine. You can configure mutt to use any SMTP server. This should be minimal mutt config.
set from      = your@emailaddr.tld
set smtp_url  = smtp[s]://[user[:pass]@]host[:port]
set smtp_user = user     # if not specified in the smtp_url
set smtp_pass = password # if not specified in the smtp_url
  1. You can create muttrc in your home directory. Remember the cron you want to send e-mails must be executed by the same user.
Related Question