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

2 Answers 2

  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.
  • Thanks, that works like a charm. I did have to put set in front of each command and add set from "mymailaddress" for the mail server to accept messages.
    – sjaak
    Mar 29, 2019 at 2:03
  • My mistake. I'll update the answer to reflect it. Mar 29, 2019 at 5:35

You can use "telnet" to send email. I did that before but just don't have a sample script on hand.

There is a good example here. https://www.novell.com/communities/coolsolutions/script-testing-smtp-telnet/

  • I'll also need to attach some files. I'm not sure Telnet supports that. It would also be good practice to try and get Mutt to work.
    – sjaak
    Mar 28, 2019 at 7:20
  • 1
    maybe this will work? thegeekdiary.com/…
    – JinChin
    Mar 28, 2019 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.