0
mail("xxxxx@xxxxxx.com",
    'This is the subject!',
    '<div style="background:black;color:green;width:100%;height:1000px;">Email email message message HEy</div>',
    "Content-type: text/html; charset=iso-8859-1; From: 1234abc"
);

When I send this to my mail, it shows as a black background and green text. But the From header doesn't work. It just shows as apache apache@ns209646.ip-188-165-193.eu where 188.165.193.158 is my servers ip address.

enter image description here

naththedeveloper
  • 4,503
  • 6
  • 36
  • 44
  • 1
    Try `From: 1234abc <1234abc@kas-craft.com>` and separate the headers with new lines. – Reeno Apr 25 '14 at 08:28
  • possible duplicate of [How to change envelope from address using PHP mail?](http://stackoverflow.com/questions/179014/how-to-change-envelope-from-address-using-php-mail) – Quentin Apr 25 '14 at 08:30

2 Answers2

1

Multiple extra headers should be separated with a CRLF (\r\n).

source

... "Content-type: text/html; charset=iso-8859-1\r\nFrom: 1234abc" ...
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

Multiple extra headers should be separated with a CRLF (\r\n).

$headers = 'From: 1234abc <webmaster@example.com>' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n";

However i suggest using an automated mailer I use http://swiftmailer.org/ and got rid of a lot of frustration because of headers in mails, also mails look better from spam assassin’s pov

Rotari Radu
  • 645
  • 6
  • 13