Re: problem sending mail
[email protected] (Elaine -HFB- Ashton) Wed, 10 Apr 2002 13:06:11 -0500
| Newsgroups | perl.scripts,perl.beginners.cgi,perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
Aman Raheja [[email protected]] quoth: *>Hi all *>I am trying to send a mail with the following code and the last print *>statement doesn't print, ie, the mail is not sent. *>This code is called on submitting a form on the web *>-------------------- *>open(MAIL, "/usr/sbin/sendmail -oi -t") || die "Can't open mail"; *>print MAIL <<END; *>To: amancgiperl\@hotmail.com *>Subject: News *>all the message goes here *>END *> *>close(MAIL); *>print "The mail has been sent successfully<BR><BR>"; *>--------------------- *>If I remove the -oi -t switch from the first statement, the print statement *>works but the mail is not sent. *>Please help and let me know what could I be missing, in or above the code. #!/usr/bin/perl -w open(MAIL, "|/usr/sbin/sendmail -oi -t -f foo\@bar.com") || die "Can't open mail"; print MAIL <<'DNE'; To: amancgiperl\@hotmail.com Subject: News all the message goes here DNE close(MAIL); Other than the obvious changes you should *always* add -w and use perl -c $programname whenever you find something works. Also, END is a reserved word so never use that in a 'here' doc. e.