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: Intermediate:
Using here documents AND sendmail?

 



Merlin
journeyman

Nov 23, 2000, 12:00 PM

Post #1 of 3 (320 views)
Using here documents AND sendmail? Can't Post

I was wondering if there's a way to use here documents while sending to sendmail? Would it work if I did something like this :
open(MAIL,"|/usr/sbin/sendmail -t")
print MAIL <<EOF;
This is the message.
Bla bla bla bla bla
...
This is the end of the message.
EOF

Would this send all the here document to the sendmail program or do I have to use another technique? I have a rather large HTML email to send via a Perl script and don't want to do a "print MAIL" statement for each line... Thanks!


CuzDesign
Deleted

Nov 23, 2000, 12:29 PM

Post #2 of 3 (320 views)
Re: Using here documents AND sendmail? [In reply to] Can't Post

Hello,
You could use something like the following code below.

This way you can create the whole body of the
email like you were talking about and send it
at once.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


# Set the body of the email message
$body = <<HERE;
Enter anything you want here.

How ever you type it it will show in the email.

HERE

# Send out the email
open(MAIL,"|$mailprog -t");
print MAIL "To: $email\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL $body;
close MAIL;
</pre><HR></BLOCKQUOTE>

Hope this helps.

Regards,
Ray

[This message has been edited by CuzDesign (edited 11-23-2000).]


Merlin
journeyman

Nov 23, 2000, 2:15 PM

Post #3 of 3 (320 views)
Re: Using here documents AND sendmail? [In reply to] Can't Post

Yep, that's a nice enough alternative. Sold! Thanks...

 
 


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

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