Wednesday 15 August 2012

php - Why is the From line not working on my mail function? -


I am using a mail function to send html to an email address, but not displayed by name and email address Are there. This is my code:

  $ name = $ _POST ['name']; $ MailTo = 'name@email.com'; $ Theme = 'message from' $ _POST ['name']; $ Message = '& lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; HTML Email & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; P & gt; & Lt; P & gt; Name: & lt; / P & gt; '$ _POST [' name ']. '& Lt; / P & gt; & Lt; P & gt; & Lt; P & gt; Email: & lt; / P & gt; '$ _POST [' email ']' & lt; / P & gt; & Lt; P & gt; & Lt; P & gt; Message: & lt; / P & gt; '$ _POST [' main message ']' & lt; / P & gt; & Lt; / Body & gt; & Lt; / Html & gt; '; $ Header = 'mime-version: 1.0' "\ r \ n"; $ Headers = 'Content-type: text / html; Charset = ISO-885 9-1 '"\ r \ n"; $ Headers = 'From: Postmaster & lt; Some@body.com> '; Mail ($ mail, $ theme, $ message, $ headers);  

I hope the e-mail should be sent as a postmaster to email some@body.com, but it appears as coming from ideapale@box486.bluehost.com

Chris, \ r \ n to & Lt; Some@body.com> Try adding after . I have found that PHP can be very smart when talking to the mail server.

Edit: To help just a bit more, I have one of my work scripts in it (almost exactly what you have):

  $ header = 'Mime-version: 1.0' "\ r \ n"; $ Headers = 'Content-type: text / html; Charset = ISO-885 9-1 '"\ r \ n"; $ Headers = 'Counter:' $ \ "\ R \ n"; $ Headers = 'To:'. $ \ "\ R \ n";  

... from where $ = $ fromname. '& Lt; '. $ Fromemail. ' & Gt; '; and $$ are just an email address.


No comments:

Post a Comment