Jump to content

PHP mail() Sending Problem


Narishm

Recommended Posts

I'm writing a PHP script that is supposed to send out an email every 5 minutes.  However I am running into a problem with the actual sending of the emails.  They seem to be randomly sending.  The emails contain a verification link that "verifies" the user account against a database.  The initial sign-up email sends, which is send from "emailtest.php" and the first verify email sends, which is sent from "autoemail.php".  However the second and third emails won't send.  The Final email sends if I delete the first two before it arrives.  Here is the code for the email

 

function vemailone($row)
{	
// Get the email address
$email = $row['email'];
// Set the Email Address to be Sent Too
$sendto = $email;
// Give a subject so the person knows what this email is about
$subject = 'Email Verification';
// Give some instructions as to what this is
$message = 'It has been 10 Minutes since your last verification.  Please click on the link below to verify your account.  If we do not receive confirmation, the next email is due to be sent to you in 5 minutes.';
// Generate the random code and string it together
$verification_code = randomCode().randomCode().randomCode().randomCode();
// Insert email and code into database
$temp = $row['autoid'];
$insert_unverified = "UPDATE main SET vcode = '$verification_code' WHERE main.autoid = '$temp'";
// Query or kill the script
mysql_query($insert_unverified) or die(mysql_error());
// Give the link for the person to verify their account
$message .= "\n\nhttp://69.89.27.230/~saveyou2/php/emailtest/emailtest.php?email=" . $sendto . '&code=' . $verification_code;
$headers =  'From: [email protected]' . "\r\n" .
			'Reply-To: [email protected]' . "\r\n" .
			'X-Mailer: PHP/' . phpversion();
mail($sendto, $subject, $message, $headers);
}

 

I'm not entirely sure why the emails aren't being sent.  Can anyone help shed some light on this?

Link to comment
https://forums.phpfreaks.com/topic/40961-php-mail-sending-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.