CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
is this alright for sending mail?

 



ultimategamer2k
User

Feb 7, 2001, 3:04 PM

Post #1 of 2 (236 views)
is this alright for sending mail? Can't Post

is this code alright for sending e-mails??

open(SENDMAIL, "|/usr/lib/sendmail -f\"UltimateGamers\"-t");
print SENDMAIL "To:$address\n";
print SENDMAIL "Subject:$subject\n";
print SENDMAIL "From:$from\n";
print SENDMAIL "Body:$body\n";
close SENDMAIL;

?

visit my web site at http://ultimategamer.cjb.net


muinatit
Deleted

Feb 7, 2001, 5:28 PM

Post #2 of 2 (234 views)
Re: is this alright for sending mail? [In reply to] Can't Post

I've never heard of the -f switch. A few things are wrong with your code..

1 - No error creation if it fails.
2 - Probably should be -tf \"UltimateGamers\"
3 - Order of the header is usually To, From, Subject.
4 - Needs to be an extra line break after the header end.
5 - Not required that Body: be in there for the body to be placed.

I always use this:


Code
open (MAIL, "|/usr/sbin/sendmail -t") || die $!; 
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$body";
close (MAIL);

muinatit
muinatit@hotpop.com

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives