Page 1 of 1

mail()

Posted: Tue Jul 29, 2003 7:31 am
by jamrop
NOt sure what i am doing wrong, but if i send email with http, in hotmail it works ok, but in outlook express it shows all the code here:

<html>Welcome david for joining AdHudd.
Your username is david and your password is hard.
Please keep these details safe
<br><br><br>To validate you account please <a href='http://www.supremeauto.com/validate.php ... 41''>click here</a> </html>

the code

Code: Select all

<?php
$headers = "MIME-Version: 1.0\n";
$headers .= "content-type: text/html; ";
$headers .= "charset=iso-8859-1\n";
$headers = "From: info@supreme.com\n";
					
mail($email, 'Member Details', "<html>Welcome $username for joining AdHudd.  Your username is $username and your password is $password. 
Please keep these details safe
<br><br><br>To validate you account please <a href='http://www.supremeauto.com/validate.php?member_id=$member_id''>click here</a> </html>",$headers);

?>

Posted: Tue Jul 29, 2003 2:19 pm
by m3rajk
to begin with i'd re-write it:

Code: Select all

<?php
# this assumes $_POST[]; contains the contents of a form

$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$member_id=$_POST['member_id'];

$subject='Member Details';

$message="<html><head></head><body><p>Welcome $username for joining AdHudd.  Your username is $username and your password is $password. <br />Please keep these details safe.</p><p>To validate you account please <a href="http://www.supremeauto.com/validate.php?member_id=$member_id">click here</a></p></body></html>";

$headers="content-type: text/html\nFrom: info@supreme.com";

mail($email, $subject, $message, $headers);
?>
remember, all headers must have \n (on a unix box and \r\n on a windows box) between them to work right.

edit: i noticed an error in the code that i fixed, also, what i left out of the headers are the mime type, which might be the default, i know for webPAGES it id, and the char set, which should default to whatever your server uses as a default

Posted: Tue Jul 29, 2003 2:50 pm
by jamrop
many thanks