For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2006 > Trying to e-mail









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Trying to e-mail
Dave

2006-10-19, 6:56 pm

I am trying to get my autoresponder working. I use the mail() function
which is fine, except I can't get it to accept more than one header.

In the headers I have put:

"From: Dave<me@somedom.com > \r\nContent-Type: text\\html"

I then get "Content-Type: text\html" as the first line of my message instead
of it being interpreted as a header.
What am I doing wrong?? I thought headers were separated by CRLF which I
think is \r\n.

Dave



Don Freeman

2006-10-19, 6:56 pm


"Dave" <dave5398@btinternet.com> wrote in message
news:jNCdnYAnrZH_B6rYnZ2dnUVZ8tednZ2d@bt
.com...
>I am trying to get my autoresponder working. I use the mail() function
> which is fine, except I can't get it to accept more than one header.
>
> In the headers I have put:
>
> "From: Dave<me@somedom.com > \r\nContent-Type: text\\html"
>
> I then get "Content-Type: text\html" as the first line of my message
> instead of it being interpreted as a header.
> What am I doing wrong?? I thought headers were separated by CRLF which I
> think is \r\n.
>


Depends on the server, mine just use \n.

I build my headers and place them in a variable as the parm for mail(),
though it is not necessary it makes it a bit more readable :
$mailheaders = "From: $_POST[EMail] \n";
$mailheaders .= "Reply-To: $_POST[EMail] \n";
// Send the mail:
mail($recipient, $subject, stripslashes($msg), $mailheaders);

--
-Don
Ever had one of those days where you just felt like:
http://cosmoslair.com/BadDay.html ?
(Eating the elephant outside the box, one paradigm at a time)


Dave

2006-10-20, 7:57 am


"Don Freeman" <freemand@sonic.net> wrote in message
news:4537a27b$0$88625$742ec2ed@news.sonic.net...
>
> "Dave" <dave5398@btinternet.com> wrote in message
> news:jNCdnYAnrZH_B6rYnZ2dnUVZ8tednZ2d@bt
.com...
>
> Depends on the server, mine just use \n.
>
> I build my headers and place them in a variable as the parm for mail(),
> though it is not necessary it makes it a bit more readable :
> $mailheaders = "From: $_POST[EMail] \n";
> $mailheaders .= "Reply-To: $_POST[EMail] \n";
> // Send the mail:
> mail($recipient, $subject, stripslashes($msg), $mailheaders);
>


It now works. In fact I need to use "\r\n" but I think I went wrong by
escaping a forward slash using text\/html whereas text/html works OK.
Still mega over slashes and escaping in php but may be getting
somewhere now - thanks.

Dave


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com