Click to See Complete Forum and Search --> : how to sent email with PHP??


dethlon
07-20-2006, 09:46 PM
guys..i need to create an password retrival function in which server have to send password requested by the client...

i realize that PHP is using the mail() function to do this....but i try the function n it is not seem to be working...
this is my testing code

<?
$email = "susanto_wang@yahoo.com";
$subject = "Password Retrieval";
$message = "aaaaaaaa";
$headers = "From: Admininstrator(susanto_wang@stellarnet.com)";

mail($email, $subject, $message, $headers);

echo "testing";

$mailsent = mail($email, $subject, $message, $headers);
if ($mailsent){
echo "success";
}

?>

i am using the hotmail pop3hot .....

i think i need to configure something in the php.ini and the smtp connection....but how actually i am going to do that..??i really have no idea how to configure these stuff to make the email thing working..pls help ~~
thanks alot....( any working example, pls post to me thanks...)

LiLcRaZyFuZzY
07-21-2006, 02:00 AM
Are you trying this on your local machine? You'll need a mail server then (like mercury)

dethlon
07-21-2006, 02:04 AM
i am using hotmail smtp server.....(pop3hot.com)....
do u have any idea how to do this???????

NogDog
07-21-2006, 02:23 AM
You might be interested in trying the PHPMailer (http://phpmailer.sourceforge.net/) class, as it comes with a SMTP class that I've used successfully for a customer's project with a minimum of pain.

dethlon
07-21-2006, 02:41 AM
dear nogdog;
....i have downloaded the php mailer....but i still dun understand how to use it? can u explain abit on this? thanks alot..

NogDog
07-21-2006, 03:06 AM
Something like this:

require_once "class.phpmailer.php";
$mail = new phpmailer();
$mail->IsSMTP();
$mail->Host = "pop3hot.com"; // verify that this is correct host
$mail->Port = 25; // verify that this is correct port on mail host
$mail->Username = "username"; // your login name on the mail host
$mail->Password = "password"; // your password on the mail host
$mail->From = "susanto_wang@stellarnet.com";
$mail->FromName = "Administrator";
$mail->AddAddress("susanto_wang@yahoo.com");
$mail->Subject = "Password Retrieval";
$mail->Body = "Password is: aaaaaaaa";
$result = $mail->Send();
if($result)
{
// it worked
}
else
{
// it didn't work, $mail->ErrorInfo will have any error message from phpmailer
}

There's a pretty thorough tutorial at http://www.phpfreaks.com/tutorials/130/0.php to learn all the stuff you can do with this class.

dethlon
07-21-2006, 03:18 AM
THanks nogdog ..i will try n see how first...thanks again..