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:
Curious about the mail process

 



This_Guy_I_Know
stranger

Jun 1, 2001, 3:43 PM

Post #1 of 7 (1819 views)
Curious about the mail process Can't Post

In O Reilly's Learning Perl book they touch briefly on the mail process:

open MAIL, "|mail YOUR_ADDRESS_HERE";
print MAIL $message;
close MAIL;

Although I know how to use a couple of the mail modules (Mail::Mailer for example), I can't help but wonder, is there any more functionality to this mail process? Can you include a subject in the email? Can you specify a From: in the header? Etc., etc..

"People are the worst drivers in the world"


randor
User

Jun 1, 2001, 4:20 PM

Post #2 of 7 (1814 views)
Re: Curious about the mail process [In reply to] Can't Post

This_Guy_I_Know,

i personally use the following mail process, it does eveything that i need it to. NOTE: i did not write this, nor do i take any credit for it, i just found it and i like its stableness and functuality.

go ahead and take a look, this does allow you to edit the subject, along with the other parts iof the mail..

#####################################
#This is a sendmail program that was public domain
#it should work on all unix systems
#####################################
sub sendemail {
$TO=$_[0];
$SUBJECT=$_[1];
$REPLYTO=$_[2];
$REMOTE = $_[3];
$THEMESSAGE = $_[4];

open(S, "|$REMOTE -t");

print S "To: $TO\n";
print S "From: <$REPLYTO>\n";
print S "Subject: $SUBJECT\n";
print S "Reply-To: $REPLYTO\n\n";

# Print the body
print S "$THEMESSAGE\n";
print S "\n";
print S ".\n";
close (S);
}

and to call to it, just use something along this line:

&sendemail("email address of who you are sending to", 'subject', 'reply to', the location of your sendmail usually something like usr/sbin/sendmail, "the body of the mail.\n\n");


I Hope this helps...

perl programmers don't die.. they just start writing a new script.


This_Guy_I_Know
stranger

Jun 1, 2001, 4:30 PM

Post #3 of 7 (1812 views)
Re: Curious about the mail process [In reply to] Can't Post

Sweet. Thanks a bunch!

"People are the worst drivers in the world"


freddo
User

Jun 2, 2001, 5:32 PM

Post #4 of 7 (1800 views)
Re: Curious about the mail process [In reply to] Can't Post

Hi TGIK,

this post maybe interresting for you too

freddo

;---
ygjohn: sometimes. you talk too much.. hahaha..


This_Guy_I_Know
stranger

Jun 5, 2001, 2:39 PM

Post #5 of 7 (1793 views)
Re: Curious about the mail process [In reply to] Can't Post

Hmmm. Interesting.

"People are the worst drivers in the world"


This_Guy_I_Know
stranger

Jun 12, 2001, 1:25 PM

Post #6 of 7 (1781 views)
Re: Curious about the mail process [In reply to] Can't Post

Argh! The script works fine, except it will only send mail locally. Any ideas what the problem might be? Anyone?

"People are the worst drivers in the world"


This_Guy_I_Know
stranger

Jun 19, 2001, 10:02 AM

Post #7 of 7 (1770 views)
Re: Curious about the mail process [In reply to] Can't Post

Okay, I've confirmed it's a problem with the server I'm on, not the script.

Thanks again!

"People are the worst drivers in the world"

 
 


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

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