|
|
| Network Programming with Perl (ISBN: 0201615711) |
 |
List Price: $44.95
Our Price: $44.95
Used Price: $22.49
Release Date: 27 December, 2000
Manufacturer: Addison-Wesley Pub Co (Paperback)
Sales Rank: 63,530
Author: Lincoln D. Stein
|
More Info
|
|
|
Perl SMTP
|
2003-01-26 23:21:42
|
| |
perl
|
|
|
|
|
Category: source:perl:internet
|
|
Description: Send an email using Net::SMTP to communicate with a SMTP server.
|
|
Platform: all
|
|
Author: detour
|
|
Viewed: 13036
|
|
Rating: 4.1/5 (90 votes)
|
|
|
| If you have any questions about
this piece of code or still need help, try posting your question on the forum. |
#!/usr/bin/perl
#
# net-smtp.pl by detour@metalshell.com
#
# Send an email using Net::SMTP to communicate to a SMTP server.
#
# http://www.metalshell.com
#
use Net::SMTP;
$from = 'your@localemail.com';
$to = 'someone@else.com';
$subject = 'Test Email';
$smtp = Net::SMTP->new('localhost');
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("Testy\n\n-bye");
$smtp->dataend();
$smtp->quit;
|
|
|