This is a function I've used in the past that works. tet
Where: $mail_prog = '/usr/bin/sendmail'; sub send_mail { local($from,$to_name,$to_addr,$subject,$content) = @_; open(MAIL,"|$mail_prog -t") || &error("unable to send mail to: $to_name - $to_addr"); print MAIL "From: $to_name ",'<',"$from",'>',"\n"; print MAIL "To: $to_name ",'<',"$to_addr",'>',"\n"; print MAIL "Subject: $subject\n"; print MAIL "$content\n"; close(MAIL); print "Mail to: $to_name - $to_addr, completed.<BR>"; } ######################################################################## #### -----Original Message----- From: Aman Raheja [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 10, 2002 1:47 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: problem sending mail It didn't work either way as suggested using -t only or changing the delimiting tag with print statetent I tried to do the same on the command line and it works. I wonder what is missing here. Help is greatly appreciated Aman >From: "Aman Raheja" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED], [EMAIL PROTECTED], >[EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: problem sending mail >Date: Wed, 10 Apr 2002 12:25:46 -0500 > >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. > >Thanks >Aman > >_________________________________________________________________ >Join the world's largest e-mail service with MSN Hotmail. >http://www.hotmail.com > _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]