Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Batch Mailing

Aziz Zouagui
Frequent Advisor

Batch Mailing


I have a question regarding email generation.

Right now, a process generates a shell script that contains 1000 to 2000 emails to be sent, Timesheet Email Alerts, like this:

mailx -s "Alert Reminder" < message
mailx -s "Alert Reminder" < message

The email Admins don't like it, they want me to change it and send the entire batch in one time, instead of multiple mailx commands.

Now, is there really a performance gain doing it like above versus one batch ?

Also, what would be the best way to implement this in a single batch versus the above ? for privacy concerns, I don't want all the email addresses to appear in the "To:" box when someone gets his/her alert.

Thank you.
Sridhar Bhaskarla
Honored Contributor

Re: Batch Mailing

Hi Aziz,

Yes. There will be a performance gain. With every message sending, you are reading the file 'message' per mailx process.

However, once the file is read first time, it will be available in buffer cache for subsequent reads. But still there will be a slight overhead of system calls.

You can do it yourself. Have the script run with 'timex ./script'. Modify the script to add multiple recepients and run it again with timex and see the difference. You should see some incrase in "usr time" and quite a bit in "sys time".

You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: Batch Mailing

while read -r recip

mailx -s "Alert Reminder" $recip < message
done < recipient.list.text

Steven E Protter
Owner of ISN Corporation