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<register@website.com>\r\n"."Reply-To: register@website.com"."\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);

?>

Link to comment
Share on other sites

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.

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.