Metaphysical has asked for the wisdom of the Perl Monks concerning the following question:
use Net::SMTP; $mailhost = 'smtp.gmail.com'; $smtp = Net::SMTP->new($mailhost) || die "Error: $!"; print "\nWho would you like the e-mail to be from?"; $from = <STDIN>; chomp $from; print "\nWho would you like to send the e-mail to?"; $to = <STDIN>; chomp $to; print "\nWhat would you like the subject of your e-mail to be?\n"; $subj = <STDIN>; chomp $subj; print "\nWhat is your message?\n"; $message = <STDIN>; chomp $message; $smtp->mail($from); $smtp->to($to); $smtp->data(); #Start the data sending #These are the headers for the e-mail. Newline character signifies end + of headers. $smtp->datasend("From: $from\n"); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: $subj\n"); $smtp->datasend("\n"); $smtp->datasend("$message"); $smtp->dataend() || print "Dataend failed: $!"; #End the data sending $smtp->quit; #Close the smtp connection
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't get Net::SMTP to work
by mr_mischief (Monsignor) on Apr 14, 2008 at 20:39 UTC | |
|
Re: Can't get Net::SMTP to work
by bingos (Vicar) on Apr 14, 2008 at 20:53 UTC | |
|
Re: Can't get Net::SMTP to work
by Metaphysical (Initiate) on Apr 14, 2008 at 21:05 UTC | |
by FunkyMonk (Bishop) on Apr 14, 2008 at 23:23 UTC | |
by bingos (Vicar) on Apr 15, 2008 at 07:59 UTC |