[SATLUG] Bulk (Mass) Mail out Question

Daniel J. Givens daniel at rugmonster.org
Tue Dec 8 22:44:27 CST 2009


On 12/8/2009 9:06 PM, Gordon Carrasco wrote:
> Not sure which is the correct terminology bulk or mass, either way I am sure
> you know what I mean.
>
> I basically have a list of 800 people that I want to send a mail to.  It
> will be just once or twice and that its.  So what is the best way to achieve
> this while on a postfix mail server?  A script or program that can read the
> list from a text file would be the easiest way.
>
> I have been looking around for a week or so but didn't find what I was
> looking for.  Hopefully someone here can point me in the right direction.
>
> Its not spam, dont worry.  I got a forum back going that has been offline
> for a couple of years.  I am just going to send out an email letting all
> those that had registered for it back then know if back.

To start, you'll want to ensure your server passes the "three-way check" 
as I call it.

1. Server HELO banner must resolve as a A record
2. The A record must resolve to the primary IP address of the server 
(the IP that the connection will be coming from)
3. A PTR record for the primary IP above must resolve back to the HELO 
banner name

That will give you the best chances of getting your message accepted and 
delivered by remote servers.

I assume you've looked at the mailing list applications such as Mailman, 
Sympa, etc. Those would be the /best/ solution, but can be cumbersome to 
get setup if you've never done it before. Mailman, for one, will allow 
you to populate a list in bulk if you have all of the addresses 
one-per-line. You can also configure the list to be "distribution" in 
nature. This is covered in the article titled "How do I create a 
newsletter, announcement, or one-way list?"

http://wiki.list.org/pages/viewpage.action?pageId=4030685

For a quick and dirty solution, you could script it out. Here's an example:

[ The main sender piece ]
*ASSUMPTION* You will want to have a "bounces at example.tld" type address 
to catch the undeliverable or rejected messages. A good way to get your 
server blocked by one of the big mail providers is to send to a lot of 
bad addresses.

Save the following as "mailer.sh" and set it exectuable:


#!/bin/bash

while read ADDR
do
     sed "s/DESTINATION/${ADDR}/" $1 | \
     /usr/sbin/sendmail -f "bounces at example.tld" ${ADDR}
done < $2


Next, create a file called "addresses" that has all of your recipient 
addresses listed one per line.
Example:

joe at foo.com
jill at bar.org
...

Finally, create a file called "message" for the message you intend to 
send. Using the following example, you will need to update the headers 
as appropriate. Don't change "DESTINATION", though, since sed is 
replacing that with the actual destination address.


From: Gordon Carrasco <gjcarrasco at gmail.com>
Reply-To: bounces at example.tld
To: DESTINATION
Subject: We're alive!

Message body, blah, blah, blah


Once you have those three pieces, you can run it like...

./mailer.sh message addresses

And be sure to remove any addresses you receive bounces for from your list.

HTH
--
Daniel J. Givens


More information about the SATLUG mailing list