Excelent email program in linux to send from command line

Looking for a program that sends emails with attachments and as html from commandline?

You have to have a look at this: http://www.cleancode.org/projects/email

Usage:

email -s "Subject" --html destiny@domain.com < mail1.txt

mail1.txt looks like this:

just some text

I just created a little script to send to a lot of people. It consisted of two files:

  • sendmails.sh
  • mailreci.txt

mailreci.txt just lists in each line a destination mail adress like this:

foo@faa.com
fee@fuu.com
du@da.com

and

sendmails.sh looks like this:

#!/bin/bash
clear
# Set the field seperator to a newline
IFS="
"
# Loop through the file
for line in `cat mailreci.txt`;do
email -s "NUEVA VENTA DE BODEGA - BETTINA SPITZ" --html $line < mail1.txt
if [ $? = 0 ]; then
echo "$line sent."
else
echo "$line not sent. ------------- OJO"
fi

done

Everything in one folder of course.

If you have any questions please feel free to comment.

Christian

Leave a Comment