emilford has asked for the wisdom of the Perl Monks concerning the following question:

My fellow Monks-

I wrote a tell-a-friend script way back when that has been functioning properly for me ever since. The one problem I see, is the From: field that arrives with each sent email.

For instance, say the from name is "Eric". When the email arrives, it contains the sending server information tacked onto the end (i.e. - Eric@xyz.abc.com). If the from name was given as Eric JonesSmith, it usually works out fine, displaying exactly Eric JonesSmith.

Could someone advise me on how to get rid of the attached server information? I found a quick-fix that works with more sophisticated email clients:

Original Code: print MAIL "To: $their_email \nFrom: $your_name\n";
Quick Fix: print MAIL "To: $their_email \nFrom: $your_name;\n";

I found that by just adding the extra ";" after the from name, smarter email clients will just ignore anything after it. This does not, however, work with hotmail or such email services.

Is there a way to get around this?

Replies are listed 'Best First'.
Re: removing server info from
by fsn (Friar) on Aug 07, 2002 at 17:33 UTC
    Does it really matter what it says in the from field? Have you ever had one user entering his or her real email address their?

    Now with that said, on to the problem. A From: line should always include an email address (you know, with an @ sign in it), but there are things you can, and should, do if you want to present a real name.

    You should write the real email address within < and > and the Full name in front. Like:

    From: William Gates III <billg@microsoft.com>
    If you were a nice player on the Internet-email arena and followed RFC's and stuff, you would make the email address end in your own domain or something, so that error messages came back to your domain. At least, don't use someone else's domain (ie. not microsoft.com).