On 2007.10.27 07:37 Rick Phillips wrote:
The scenario is that people who wish to act as
volunteers fill out a web based form which adds
their names and email addresses to a text based
file. He then uses as his data base to send
newsletter emails from time to time. He also
uses this for announcements which are small (30k).
He uses the perl mail::sendmail to send this mail
but finds that it takes six or more seconds to
send each email. My server runs qmail which I
have used for many years and find to be rock solid
and absolutely trouble free.
Is the 6 seconds or so normal or should we be
expecting something much faster? Should he be
trying a different method. Qmail can be used from
the traditional sendmail call.
I haven't looked at the perl module but I would speculate that it loops
through the address list sending the message to each recipient seriatim
as if each individual message were the only one being sent. This means
that contact (and handshaking and, if necessary, authentication) with
the upstream ISP must be made each time before the message is sent.
Following its sending the connection is dropped and a subsequent
reconnection is made to send the next message. See, for example, the
send-queue script accompanying msmtp. Internet lore and practice also
dictates that there should be a sensible gap (of, say, one second)
between dropping one connection and initiating the following
(re)connection.
It is easy to see how six seconds per message can result.
Assuming that you don't want to stuff your To, Cc and Bcc headers with
up to 100 addressees at a time (100 is the **minimum** number that
**must** be accepted by an MX server) then the answer lies in moving
the loop to a different location in your application (ie, move the loop
from "send to MX" to "send to queue").
Proper bulk senders, whether they are Good Vibe applications such as
mailman or are nasty spammers, hold open a single connection to an MX
server while they send all mail for that server. The increase in
efficiency (ie, speed of throughput) is remarkable.
Your solution is, IMO, either to use a mailing list manager (eg,
mailman) in announce mode, or to write a script in your favourite
language which utilises a lightweight upstream relay that has a
queueing function (eg, nullmailer, email-relay, masqmail). I **do not**
recommend msmtp for this task.
I am extremely reluctant to post any solid information to a public
forum for fear of assisting lurking nasties. However, if you care to
contact me off list and satisfy me of your friend's bona fides (I am
not casting aspersions by that requirement) I should be happy to give
you a bash script that I use to inform four dozen or so of my most
intimate friends that the next meeting of our local LUG is imminent.
HTH,
Robert Thorsby
Nothing is better than grub;
Lilo is better than nothing;
Ergo, lilo is better than grub.
-- Anon
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html