Recently I faced with the task: I needed to send thousands of e-mails with a survey link to all students in university. The problem of mass mailing from a desktop client is that the whole students list is visible in the CC field. I solved this problem through a simple command in terminal using mutt.
Mutt is a text-based email client for Unix-like systems. It was originally written by Michael Elkins in 1995 and released under the GNU General Public License version 2 or any later version.
Okay, lets get to work. First we need to create a configuration file:
$ vi ~/.muttrc
Now we need to configure the name and the address:
set realname=«John Smith»
set from=«jsmith@whitehouse.gov»
set use_from=yes
Now create a body:
$ vi ~/body
Of course, the e-mail body is in rich-html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=«Content-Type» content=«text/html; charset=utf-8»> </head>
<body>
<p><font color="#2E7BE4"><em><strong>Hello!</strong></em></font></p> <p align="justify">This is the email-body in HTML</p>
<p><font color="#2E7BE4"><strong><i>Best wishes</i></strong><br></font>
</p>
</body>
</html>
Now we need a recipients list:
$ vi ~/list
email@mail.com
email2@mail.com
...
Okay, now we are ready to send our e-mail:
$ for I in
cat list; do cat body | mutt -e "set content_type=text/html" -a "attachment.pdf" -s "E-Mail Subject" -- $I < body; echo $I; sleep 3; done
Now mutt will send rich html e-mails every three seconds to recipient list we created.