I have a page that send users their password but nobody recieves the emails. Can somebody tell me why please, because I can't see anything wrong $subject = "Password Retrieval - $username"; $message = " Dear $username, Your password is $password Enjoy Admins This is an automated response, please do not reply!"; if (mail($email, $subject, $message, "From:admin@mywebsite.com")){ die("<b>An email has been sent with your password!<br>Make sure you check your Junk Folder!</b>"); } PHP: Thanks
<?php require_once "Mail.php"; $name=$_POST['name']; $address= $_POST['address']; $email=$_POST['email']; $from = $name; $to = "write email id where you want to send"; $sub=$_POST[sub]; $msg =$name."\n".$_POST['msg']."\n"; $host = "localhost"; $username = "your company mail id"; $password = "password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!!</p>"); } ?> Code (markup): Use the above code i u r sending mail to yahoo,gmail etc and use mail() for mailing to your server email id
Maybe mail() function in your server disabled. U should be using PHPMailer which good library for send mail function.
Whatever "Mail.php" is, he doesn't have it. Anyway, the only thing I see that could be wrong is that you don't define the $email variable anywhere.