best/easiest commandline email program for mass-email

Hal Burgiss hal at burgiss.net
Thu Jan 28 00:02:32 UTC 2010


On Wed, Jan 27, 2010 at 03:09:46PM -0500, Alex Janssen wrote:
> I must send personalized email to our clients, about 2500.  So I figured 
> on putting together each with a shell script and then sending the file 
> with a commandline email program.  I was looking for suggestions on what 
> might be the best package to install for this.  I have seen a suggestion 
> for a program called "mail", but I can't figure out what package to 
> install to get it.  I looked at the list presented by Synaptic, but 
> there's a boat load of programs related to email.
> 
> If anyone has done this sort of thing, I'd sure appreciate your suggestions.
> 
> Thanks,
> Alex
> -Ubuntu 9.10 on several computers since version 5.04

As mentioned, the mailx packaged (I think) contains the 'mail' command:

cat $email_list |while read email;do
	cat $boiler_plate | mail -s "$mysubject" $email
done

Also, there is a command line version of mutt, which can handle attachments.
So I use mutt for attachments, otherwise just 'mail'.

You can also echo text directly to "sendmail", but you have to build your
headers from scratch. Not as difficult as it sounds:

( echo "From: $from"
  echo "To: $to"
  echo "Subject: $subject"
  echo "Reply-To: $replyto"
  ! [ "$cc" == "" ] && echo "Cc: $cc"
  ! [ "$bcc" == "" ] && echo "Bcc: $bcc"
  echo "$x_lines"
  if $HTML; then
   echo  "MIME-Version: 1.0"
   echo "Content-Type: text/html; charset=\"ISO-8859-1\""
  fi
  # Add required blank line to separate header/body.
  echo
  # Body goes now ...
  cat $tempfile
) | $sendmail $ffrom


-- 
Hal




More information about the ubuntu-users mailing list