Jump to content

Email not sending with PHP


unistake
Go to solution Solved by ginerjm,

Recommended Posts

Hi guys,

 

I am trying to create a simple PHP script to send a new password to my users using the script below.

 

I believe it was working however seemed to stop after a few tests. Any ideas why?

 

Thanks

			$rand_password_md5 = md5($rand_password);
			
			$sql = "UPDATE Users SET password = '$rand_password_md5' WHERE username = '$code' AND Base = '$base'";
			$result = mysqli_query($cxn,$sql)	
				or die ("Can not change your password in our database.");
			
			// the email reply
			
			// use wordwrap() if lines are longer than 70 characters
			$msg = wordwrap($msg,70);

			// send email
			$to = $row['Femail'];
			$subject = "website.com | Password reset requested.";
			$txt = "Hi ".$row['Ffname'].", Please go back to www.website.com and login with your username ".$row['username']." and new password ".$rand_password.". You can then change your password by going to 'Settings' > 'Personal Settings'.!";
			$headers = "From: noreply@website.com" . "\r\n" .
			"CC: info@website.com";

			mail($to,$subject,$txt,$headers);
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.