0

I used to have a major problem on my old hosting package where emails from my website to yahoo/bt just disappeared into the ether. I have since changed hosts and re-formated my mail scripts to use phpmailer SMTP and all generally appears to be working much better.

However I seem to be receiving more and more complaints that people are requesting their username or password and not receiving the email (or the registration email) and I have no idea why. This time there doesn't appear to be any pattern with isps.

Has any had this problem and been able to solve it or can anyone suggest a solution?

In case it helps, the code for the forgotten password facility is below (I have received no indication of errors being generated):

$fail=0;
$fail_reason='';

if (!empty($_POST['button_submit']) && isset($_POST['username']))
{

	$auth_obj=new auth;
	$auth_obj->username=mysql_real_escape_string(trim(strtolower($_POST['username'])));
	$auth_obj->getuser();
	
	$email=$auth_obj->user_email;
	$username=$auth_obj->username;

	if (!empty($username))
	{
			$user_auth=generate_password();
			$pwd=sha1($user_auth);
			$obj_db=new database;
			$obj_db->connect();
			
			$sql=mysql_query("SELECT user_id FROM users WHERE username='$username'");
			$query=mysql_fetch_array($sql);
			if (!empty($query['user_id'])) {
			mysql_query("UPDATE users SET user_auth='$pwd' WHERE username='$username'");
			}
			else {
				header ("location: forgot_user.php?user_fail=1");
			}
			
			$mail = new PHPMailer;
			$mail->IsSMTP();
			$mail->Host = SMTP_HOST;
			$mail->Port = SMTP_PORT;
			$mail->SMTPAuth = true;
			$mail->Username = SUPPORT_USERNAME;
			$mail->Password = SUPPORT_PASSWORD;
			$mail->FromName = FROM_NAME;
			$mail->From = SUPPORT_USERNAME;
			$mail->IsHTML(true);
			
			$mail->AddAddress($email);
			$mail->Subject = 'Simply Canine Account';
			$mail->Body = "<p>Your Simply Canine account password has been reset to:</p>";
			$mail->Body .= "<p>".$user_auth."</p>";
			$mail->Body .= "<p>Please go to http://www.simplycanine.co.uk/login.php to login. You may also change your password to something more memorable if required.</p>";
			
			if(!$mail->Send()) {
			   echo "Error sending: " . $mail->ErrorInfo;
			} else {
			   $success_message="<p>An e-mail containing your new password has been sent to: <strong>$email</strong></p>";
			   $success_message.="<p>Once received, please <a href=\"/login.php\">login</a> again.</p>";
			}
	}
	else
	{
		$fail=1;
		$fail_reason='Your username could not be found, please try again.';
	}
}

I have tested all the basics and get no problems or errors.

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by simplypixie
0

your website host also provides you with a log for smtp emails in and out
i would ask the user what day and around what time it happened to see if there was
a error in smtp maybe it got blocked or failed there

0

Thank you - I will ask my hosts where that error log is as not in my normal error log files.

0

i know i had a issue with my website being able to send a speficiy amount of emails in a given hour it was hard to find untill i got the email error log

0

I have checked the error log and apart from a problem with aol, other emails that have not arrived seemed to go through OK and these aren't multiple emails just one here and there (in fact when I send multiple emails it seems to work better).

Only advise my host can give (and was the same before) is for my customers to contact their ISP and find out what happened to the email - not practical really.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.