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:
Send email from perl script

 



StarkRavingCalm
User

Feb 12, 2013, 1:08 PM

Post #1 of 3 (523 views)
Send email from perl script Can't Post

I am adding email function to a script but cannot get the body of the message to work. NOTE: Everything else works except for the body.
Can someone tell me what I am missing?


Code
open(MAIL, "|/usr/sbin/sendmail -t"); 

## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";

## Mail Body
print MAIL "this is the body of the message";

close(MAIL);

Code
 

Thanks!


FishMonger
Veteran / Moderator

Feb 12, 2013, 1:26 PM

Post #2 of 3 (520 views)
Re: [StarkRavingCalm] Send email from perl script [In reply to] Can't Post

You need a blank line between the headers and the body.

change:

Code
print MAIL "Subject: $subject\n";

To:

Code
print MAIL "Subject: $subject\n\n";



StarkRavingCalm
User

Feb 13, 2013, 1:43 PM

Post #3 of 3 (510 views)
Re: [FishMonger] Send email from perl script [In reply to] Can't Post

That worked!
Thank you!

 
 


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

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