mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

mail()

Post 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);

?>
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post 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
Last edited by m3rajk on Tue Jul 29, 2003 2:55 pm, edited 1 time in total.
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

Post by jamrop »

many thanks
Post Reply