I wrote the following script to send mail but it doesn't seem to work.
<?php
if($submit)
{
$db = mysql_connect("localhost", "d99kd", "mypass");
mysql_select_db("d99kd",$db);
$dbQuery="SELECT * FROM users where username='$theusername'";
$result = mysql_query($dbQuery,$db);
$userInfo=mysql_fetch_array($result);
$username=$userInfo["username"];
$password=$userInfo["password"];
$userFunctions=$userInfo["userFunctions"];
$firstName=$userInfo["firstName"];
$lastName=$userInfo["lastName"];
$emailAddress=$userInfo["emailAddress"];
$mailsubject = "Your password";
$mailbody = "Your Password is $password";
//if(mail($emailAddress, $mailsubject, $mailbody))
//{ echo "XXX good";
//}
$myname = "Darren Kane ";
$myemail = "darrenjkane@yahoo.co.uk";
$message = "Your password is $password - Don't forget it again!";
$subject = "Your Password";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$firstName.$lastName." <".$firstName.$lastName.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
if (mail($emailAddress, $subject, $message, $headers))
{
echo "Good";
}
else echo "Bad";
}
?>
=============================================
It compiles ok but the mail doesn't get sent. Do any of you know why?
Also how do you include a picture attachment?
Thanks, D.