Chady has asked for the wisdom of the Perl Monks concerning the following question:

I really am sorry to waste valuable resources and post an OT question... but I am really stuck.

here's the deal: my company uses another company to send the newsletter to the (25000+) mailing list... and the boss decided to check if we can run our own mailings ( actually for sake of cost ).

I found out that Sendmail uses a lot of resources, and I can't actually run a perl script on the websites server to send the emails... I assume it will jam the server up.

so we thought of installing a local server, that we will use to send emails... we don't want to recieve emails through... just use it to send emails.

what kind of resource would we need? that's the question. I mean, is it just like installing linux on a PC, plugging in a modem, and hacking scripts that use sendmail? or does the machine has to have a public ip and a domain like a normal http server?

I really don't know much about the topic, and would appreciate some help or resources.

once again.. thanx, and sorry for the OT question.


He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Replies are listed 'Best First'.
Re: (OT) Sending emails
by davis (Vicar) on Oct 26, 2001 at 14:56 UTC
    Hi,
    First of all, I'm fairly sure you don't need to run a mailserver at all, you just need a box with internet access to an ISP that accepts mails from you.
    You can use modules such as Net::SMTP to send the mail.
    here's some code which I've dug out of another script. It's untested in its current form
    #!/usr/bin/perl -w use strict; use Net::SMTP; my $mailserver = "mailserver.yourisp.com"; my $mailfrom = "From: \"Big Company\" <big_company\@domain.com>\n"; my $mailto = "To: \"Joe Blogs\" <joe_bloggs\@clients.com>\n"; my $subject = "Blah, blah, blah"; foreach $infile (@ARGV) { if(!open MESSAGE, "<$infile") { print STDERR "Couldn't open $infile: $!\n"; next; } my $message; my $smtp = Net::SMTP->new($mailserver); my $mailfrom = $1 if($displaymailfrom =~ /^[^<]*<([^>]+)>/); my $mailto = $1 if($displaymailto =~ /^[^<]*<([^>]+)>/); $smtp->mail($mailfrom); $smtp->to($mailto); $smtp->data(); $smtp->datasend($subject); $smtp->datasend($displaymailfrom); $smtp->datasend($displaymailto); while(<MESSAGE>) { $smtp->datasend($_); } $smtp->dataend(); $smtp->quit; close MESSAGE; }
    Hope that helps
Re: (OT) Sending emails
by echo (Pilgrim) on Oct 26, 2001 at 15:45 UTC
    Easiest is to use your upstream's SMTP server if possible, as suggested by a previous reply. If you can't / don't want to do that, then you certainly can install an outgoing only SMTP server. If you don't like sendmail, check out Postfix, installation is easy on any Unix like system. Your scripts can then post all email to it, I tend to prefer Mail::Sender over Net::SMTP because of its higher level interface. Either way, posting emails via SMTP will save your web scripts the overhead of spawning a new process.