|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-11-25 10:59 UTC] sarah at perceptiondesign dot net
* PHP version is actually 4.1.2 but Server is hosted with NTT/Verio so unable to update PHP version
I am testing my mail function where a user enters their subject and message on a form and the next page pulls emails from a database and mails out to everyone. When I put the word From in the message box in the format From.. or From then on.. or From Sat 16th. it displays a '>' before the word From like this >From then on..
It doesn't do this with lower case from or upper case. It is ok when you insert a space before writing From.
I thought it might be getting mixed up with the From tag. My code is this:
<?php
echo "Emails have been sent to the following people: <br><br>";
$header = "From: Blair Drummond Safari Park <info@blairdrummond.com>\n";
$header .= "Content-Type: text/html\n";
$db = mysql_connect("localhost", "******", "******");
mysql_select_db("******",$db);
$result = mysql_db_query("******","select * from consumers where email<>'' and email <> ' ' and mailing<>-1");
while ($row = mysql_fetch_array($result)) {
echo $row["email"]." (".$row["first_name"]." ".$row["surname"].") ";
mail($row["email"],$subject,$message,$header);
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
I have tried taking the new line breaks out of my previous code but am still getting the same result. I have taken the code below from phpbuilder.com and put in my email address and the message "From then on" and the output was the same: >From then on <?php mail("sarah@perceptiondesign.net", "the subject", "From then on", "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); ?>Fixed the problem by replacing all instances of "From " with "<b></b>From " and this seems to work. Thanks for your help Derrick. <?php $xmessage = str_replace ("From ", "<b></b>From ", $message); echo "Emails have been sent to the following people: <br><br>"; $header = "From: Blair Drummond Safari Park <info@blairdrummond.com>\n"; $header .= "Content-Type: text/html\n"; $db = mysql_connect("localhost", "safa16", "tybfg+nfcvf"); mysql_select_db("safa16",$db); $result = mysql_db_query("safa16","select * from bd_consumers where email<>'' and email <> ' ' and mailing<>-1"); while ($row = mysql_fetch_array($result)) { echo $row["email"]." (".$row["first_name"]." ".$row["surname"].") "; mail($row["email"],$subject,nl2br($xmessage),$header); } ?>