note 19373 modified in function.mail by derick

From: Date: Sat, 15 May 2004 13:26:30 +0000
Subject: note 19373 modified in function.mail by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69646@lists.php.net to get a copy of this message
Watch out for subject lines with a \n at the end (or presumably anywhere). mail() won't strip this off the end and any additional headers specified in the fourth parameter will get stuck at the beginning of the body. Exmaple: mail("joe@example.com", "Registration Confirmation\n", "This is to confirm your registration... blah...", "From: registration@example.com"); Sends a message to joe@example.com with a subject of "Registration Confirmation" as expected, but shows the userid of the process running the web server as the sender and has the following as a body: --------------------------------- From: registration@example.com This is to confirm your registration...blah... --------------------------------- a quick "trim($subject)" solves this. --was-- Watch out for subject lines with a \n at the end (or presumably anywhere). mail() won't strip this off the end and any additional headers specified in the fourth parameter will get stuck at the beginning of the body. Exmaple: mail("joe@php.net", "Registration Confirmation\n", "This is to confirm your registration... blah...", "From: registration@php.net"); Sends a message to joe@php.net with a subject of "Registration Confirmation" as expected, but shows the userid of the process running the web server as the sender and has the following as a body: --------------------------------- From: registration@php.net This is to confirm your registration...blah... --------------------------------- a quick "trim($subject)" solves this. http://www.php.net/manual/en/function.mail.php

« previous php.notes (#69646) next »