NYCPHP Meetup

NYPHP.org

[nycphp-talk] Botched email header

Jeff jsiegel1 at optonline.net
Thu Jul 24 17:44:47 EDT 2003


You got me...I'm convinced. (No sarcasm intended.)

Jeff

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Chris Shiflett
Sent: Thursday, July 24, 2003 4:38 PM
To: NYPHP Talk
Subject: RE: [nycphp-talk] Botched email header


--- Jeff <jsiegel1 at optonline.net> wrote:
> My concern is that I don't want the From address to have
> double-quotes around it.

In your email, the following is the From header used:

From: "Jeff" <jsiegel1 at optonline.net>

That is the format you want to achieve when you specify your own mail
headers.
It really doesn't matter whether you *want* the format to be this way,
because
that is not your decision. Does that make better sense now?

> Of course I can't let the emails go out with botched up headers
> but I'm leaning in the direction of a solution that would clean
> up these anomalies (which are a handful of cases) and leave the
> other stuff alone.

These aren't anomalies. Commas are fairly common within the name part of
a From
header, and they don't require any special handling so long as you
adhere to
the proper format as I initially suggested. The only potential problem
would be
whether the name already contains a quotation mark (which is something
you
should filter prior to the code in question) or some other invalid
character
(\r\n would be bad, too). Along the same lines, you want to make sure
the email
address is a valid email address. Assuming you have properly filtered
your data
(which was my initial assumption), something as simple as this will
work:

$from_header = "From: \"$name\" <$email>\r\n";

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list