You can run an MTA on your own machine (common on *nix machines). You have to hit an SMTP server at some point.
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
| [reply] |
You have two basic options --
- Run an SMTP server locally.
- Deliver directly to the recipient's mail server
If you're running a server locally, it doesn't have to listen to on a port. You can configure some mail programs (sendmail being the standard, but I've also done it with postfix), so they're running as a daemon, and accept local delivery, and will handle the processing. (including requeuing on failed delivery attempts). I typically do this on any desktop, as you can have times when a cron job fails delivery, and it just gets left in the mailqueue. If you attempt to handle the delivery directly, you can use Net::SMTP to connect to the server and drop off the mail. However, you'll need to determine the correct MX server to drop off the mail. (see Net::DNS). Remember, however, that you'll be responsible for any requeuing that might be necessary. Please also be aware that many sites are using multiple layers of spam filtering, both on the inbound and outbound. Your network may not allow port 25 connections out, and if you're connecting through an ISP, your netblock may be flagged as a dialup (or similar, non-fixed) connection, and the message could be dropped on receipt, without a response.
| [reply] |
As hardburn wrote, it's not possible to send mail without using an SMTP server *somewhere* in the progress. It's like... sound which never reaches an ear: it won't be heard :)
| [reply] [d/l] |
You can run your own SMTP server and send through that. It's not hard to find a free one. However, a lot of hosts will reject email coming from a dynamically generated IP, so if the mail really has to get there, it's better to feed it through a remote hosting account with a domain name. The hoster may kill your account if you're caught spamming, however, so you better be dang sure the people receiving the emails want to receive them, and that you don't overload their mail server by bombing it with thousands of emails all at once. | [reply] |
u can start Send mail locally. This will act like a smtp server and u can use MIME::Lite or Net::SMTP as mail client. These two perl modules are used widely for mail client.
See also other mail clients in cpan
--prasanna.k | [reply] |
I might also suggest Mail::Mailer. Here is a proof-of-concept program for you to look at that acts as a Perl-based email transmission client:
#!/usr/bin/perl -w
use Mail::Mailer;
$smtp = Mail::Mailer->new("smtp","Server","smtp.server");
print "To: ";
$to = <STDIN>;
chomp($to);
print "Subject: ";
$subject = <STDIN>;
chomp($subject);
print "Body:\n";
while ($line = <STDIN>) {
last if $line eq ".\n";
$body .= $line;
}
chomp($body);
print "Opening SMTP connection...\n";
$smtp->open({
"From" => "email\@example.com",
"To" => $to,
"Subject" => $subject
});
print $smtp $body;
print "Sending email...\n";
$smtp->close() or die "Can't close mailer: $!";
print "Mail sent.\n";
Obviously, using strict is recommended.
| [reply] [d/l] [select] |