NYCPHP Meetup

NYPHP.org

[nycphp-talk] Email Pain

(Margaret) Michele Waldman mmwaldman at optonline.net
Sat Aug 9 23:48:12 EDT 2008


First thing I tried was \r\n.  Didn't fix the problem.

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Michael B Allen
Sent: Saturday, August 09, 2008 11:34 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Email Pain

On Sat, Aug 9, 2008 at 10:38 PM, (Margaret) Michele Waldman
<mmwaldman at optonline.net> wrote:
> Folks,
>
>
>
> I'm working with this mail function again.
>
>
>
> Unhappily.
>
>
>
> The mail message is created using data off of an html form using radio
> buttons, selects, text input, etc.
>
>
>
> The oddest thing is happening.  Sometimes newlines are ignored.
>
>
>
> Where formated like this:
>
>
>
> $message = @<<<END
>
> This is field 1: $field1
>
> This is field 2: $field2
>
> This is field 3: $field3
>
> This is field 4: $field4
>
> END;
>
>
>
> Or like this:
>
> $message = "This is field 1:".$field1."\n";
>
> $message .= "This is field 2:".$field2."\n";
>
> $message .= "This is field 3:".$field3."\n";
>
> $message .= "This is field 4:".$field4."\n";
>
>
>
> The message might look like this:
>
>
>
> This is field 1: data
>
> This is field 2: data This is field 3: data
>
> This is field 4: $field4

What mail sending routines are you using?

If you're using the 'mail' function, first simplify your test case.
Try something like the following:

  $email = 'whomever at example.com';
  $subject = 'This is the subject';
  $headers = "From: $email\r\nReply-To: $email";
  $message = "This is a message\nwith multiple\nlines\nof\ntext\n";
  mail($email, $subject, $message, $headers);

Note that the headers should use "\r\n" as opposed to just "\n"
(technically you should use the linebreak indicated by the server but
that's more involved).

If that works, then narrow down the difference with trial and error.

If it doesn't work, get a packet capture, open it with WireShark and
verify the content of the outgoing message. If the message is screwed
up going out that narrows down things quite a bit.

Mike

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php




More information about the talk mailing list