
Rivotti
User
Mar 30, 2000, 7:52 AM
Post #3 of 3
(450 views)
|
Hi Eisenhower: Here's two examples for sending mail. Using Sendmail: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $to = 'other@site.com'; # here the address you wanto to send the mail $from = 'me@site.com'; # here your address $maildir = '/usr/sbin/sendmail'; # here the path to sendmail program. It's usually this. open (SENDMAIL, "| $maildir -t"); print SENDMAIL "From: $from\n"; print SENDMAIL "To: $to\n"; print SENDMAIL "Subject: Mail\n"; print SENDMAIL "Write the message here"; close (SENDMAIL); </pre><HR></BLOCKQUOTE> Using NET::SMTP <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> use NET::SMTP # you must use this line $to = 'other@site.com'; # here the address you wanto to send the mail $from = 'me@site.com'; # here your address $server = 'your mail host here'; $smtp-> NET::SMTP->new($server); $smtp->mail($ENV{USER}); $smtp->from($from); $smtp->to($to); $smtp->data(); $smtp->datasend("From: $from\n"); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: Mail\n"); $smtp->datasend("You can write your message here\n"); $smtp->dataend(); $smtp->quit; </pre><HR></BLOCKQUOTE> These are the basic. You should consult CPAN in www.perl.com for more info Rivotti
|