best/easiest commandline email program for mass-email
Alex Janssen
alex at ourwoods.org
Tue Feb 2 22:55:31 UTC 2010
Thanks for your help, Hal and to everyone else, too.
This should make it easier for someone else to get a mass-mailer working.
Here's what I did:
Install mailx
sudo apt-get install mailx
I'm not sure if the next two steps are needed, but it does tell you what
to do next.
sudo dpkg-reconfigure sendmail
Select none for configuration
You see the message:
Postfix was not set up. Start with
cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix
configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Modifiy main.cf below.
Now, set up SMTP AUTH
Tutorial at
http://postfix.state-of-mind.de/patrick.koetter/smtpauth/smtp_auth_mailservers.html
Quick synopsis of the above tutorial:
Create plaintext file named sasl_passwd in /etc/postfix with one line
per login with the domain name and a login-name:password pair.
Example:
smtp.mailserver.com username:userpassword
Create database file from sasl_passwd with the following command:
postmap hash:/etc/postfix/sasl_passwd
Add the following variable definitions to main.cf:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
address_verify_sender = username at domain.com
Substitute a real address for address_verify_sender.
Reload Postfix with the following command as root:
postfix reload
My test bash script follows:
# the mail program
SENDMAIL="/usr/sbin/sendmail"
SUBJECT="HTML test"
BODYPART1="/path/to/emailpart1.txt"
BODYPART2="/path/to/emailpart2.txt"
# Errors are sent here
SENDER="myaddress at mydomain.com"
# put this in a loop
MAILTO=someone at somewhwere.com
# Do a loop for a bunch of emails from a file
# Un-comment here and below to make the loop work.
# while read MAILTO
# do
# the following section is an alteration of Hal Burgiss's suggestion on
Ubuntu users list 1/27/2010
( echo "From: $SENDER"
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "Reply-To: $SENDER"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html; charset=\"ISO-8859-1\""
# Add required blank line to separate header/body.
echo
# Body goes now ...
cat $BODYPART1
echo $MAILTO
cat $BODYPART2
) | $SENDMAIL -t -f $SENDER
# Pause here to keep from overloading the mail server and drawing attention
#sleep 2
# substitute your email list name after the input redirector, <
#done < list_of_email_addresses
# Redirecting input from end of loop does not start a sub-shell in bash
exit 0
--
Ourwoods.org
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (275)
More information about the ubuntu-users
mailing list