Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mime::Lite "Real Name" problem

Status
Not open for further replies.

redgenie

Programmer
Aug 10, 2000
36
GB
I'm sending emails with Mime::Lite using SMTP and I cannot find a way to use "Real Names" as shown below for my From field.

"Keith Boynton" <keithboynton@somewhere.com>

Should be perfectly valid?

Yet using Mime::Lite it doesn't work, I think where it actually falls over is in the function _addr in Net::Smtp which sticks <> around everything.

Has anyone successfully managed to send emails with this format, here is what I have tried:

Code:
my $fromAddress="\"Keith Boynton\" <keithboynton\@somewhere.com>";

my $mime_msg = MIME::Lite->new(
	   From       => $fromAddress,
	   To         => $recipient,
	   "Reply-To" => $replyTo,
	   "CC"       => $cc,
	   "BCC"      => $bcc,
	   Subject    => $subject,
	   Type       => $mime_type
	   );

It works perfectly for addresses without the "Real Name" part.

Any help would be greatly appreciated.....
 
You don't need the quotes around the real name.

This is from code that I'm using in a "production" environment, so it has been tested and is fully functional. Well, I did change the email address from the real one [smile]...
Code:
my $from           = "Elvis Presley <elvis\@presley.com>";

    my $email = MIME::Lite->new (
        From    => $from,
        To      => $contacts,
        Subject => $subject,
        Type    => 'multipart/mixed',
    );

--
-- GhodMode
 
Hi GhodMode,

Thanks for your post, I've tried that beleive me and many other combinations. I read an article that it's a more recent version of Net::Smtp that causes the problem, apparantly it used to work but stopped working in a more recent version of Net::Smtp. I can't find the d&^%! article now or I would have posted a link to it.

I've looked at the _addr function in Net::Smtp and it adds <> around everything so the address ends up as <Keith Boynton <keithboynton@somewhere.com>>. I've even fudged it to "force" the address to be Keith Boynton <keithboynton@somewhere.com> and it still complains from somewhere further down.

My version 2.24 on Win32, I'll bet your version is earlier.

Thanks anyway :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top