Jump to content

mail() function not sending emails on time!


Northern Flame

Recommended Posts

In my register page,

an email is sent out to the user once he/she registers.

The email is sent and everything works fine,

but the email is sent 2 or 3 days after registering!

why is it taking so long?

im on a shared host so I can't modify my php.ini file,

but is this something that should be changed from

the php.ini file? (so that i can contact my host about this).

 

Any ways, just in case it can help, heres my mail() code:

 

<?php

			$headers = "From: My Website<[email protected]>\r\n"."Reply-To: [email protected]"."\r\n"."X-Mailer: PHP/" . phpversion();

			mail("$mail", "Confirmation", "
			Dear $user,

			In order to be registered to My Website, you must click
			the link below. If you do not click that link in 1 week, your
			account will be deleted!

			Your login information is listed below (save this information!):
			Username: $user
			Password: $pass

			To complete your registration, click this link:
			http://www.website.com/members/confirm.php?action=register&username=$user&key=$key

			This message was brought to you by My Website. Please do not reply 
			to this message. If you did not register to this site, just ignore this
			email and your information will be taken off our database in 1 week.

			- My Signature", $headers);

?>

The length of time it takes for the mail to be sent is not reliant on your PHP code. It takes such a long time because the server you are using is either a slow server, or perhaps someone is sending out massive amounts of spam mail or some other form of unapproved behavior and is hogging the servers resources.

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.