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 a real name with Sendmail?

 



Merlin
journeyman

Jun 21, 2001, 7:51 AM

Post #1 of 3 (420 views)
Using a real name with Sendmail? Can't Post

I'm trying to insert a "real name" besides the e-mail adress of the sender with Sendmail and can't quite get the syntax to do it... My code :
open MAIL,'|/usr/lib/sendmail -t' || die "Erreur d'ouverture de SENDMAIL.";
print MAIL "From: $formdata{'provenance'}";
if (exists $formdata{'nomreel'}) {
print MAIL " $formdata{'nomreel'}";
}
print MAIL "\n";
print MAIL "To: $formdata{'destinataire'}\n";
print MAIL "Subject: $formdata{'sujet'}\n";

I'm checking here if "nomreel" (realname) exists and insert it besides the sender's e-mail. I guess this is a rather basic syntax thing but I couldn't find any info on this. Thanks!



mhx
Enthusiast / Moderator

Jun 21, 2001, 9:12 AM

Post #2 of 3 (418 views)
Re: Using a real name with Sendmail? [In reply to] Can't Post

Hi Merlin,

The syntax you need is:

Code
From: Merlin <merlin@email.com> 
To: Marcus <marcus@nowhere.org>
...

So for your script, I'd recommend something like:

Code
open MAIL,'|/usr/lib/sendmail -t' or die "Erreur d'ouverture de SENDMAIL."; 
print MAIL "From: ";
if (exists $formdata{'nomreel'}) {
print MAIL "$formdata{'nomreel'} <$formdata{'provenance'}>";
}
else { print MAIL $formdata{'provenance'} }
print MAIL "\n";
print MAIL "To: $formdata{'destinataire'}\n";
print MAIL "Subject: $formdata{'sujet'}\n";

-- Marcus



Merlin
journeyman

Jun 22, 2001, 12:31 PM

Post #3 of 3 (409 views)
Re: Using a real name with Sendmail? [In reply to] Can't Post

Super, 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