Jump to content

mail()


mastix

Recommended Posts

would anyone know what would cause the mail() function in a webpage cease working? the page now stalls for 3 minutes and the mail does not get sent. This was working just fine up to yesterday!!!! no changes in the code, just stopped working. ISP very slow in addressing this. Please help if you have a clue! thanks

Link to comment
Share on other sites

It seem highly likely that something on the server is broken.  Typically mail just dumps the email out to the mta using sendmail, unless otherwise configured.  If your server is configured to send the mail to the ISP's email server, then it's highly likely that their server is having issues and php is hanging on script attempting to make an smtp connection to their server and relay the outbound email.

 

 

Link to comment
Share on other sites

There is another obviouse reason. I have had this once. The mail function takes 5 parameters.

 

mail($to,$subject,$message, $headers, '-froot@mywebsite.com');

It is possible that your provider has changed something. Mine did this to me. Try adding the 5th parameter with your website name.

 

Desmond.

 

Link to comment
Share on other sites

thank you.

could you please be more specific about the 5th parameter?

Lets say website is www.mysite.com, the email address is me@mysite.com.

what would the 5th parameter look like? Also, can I use a $email variable instead as email address in the 5th parameter?

Link to comment
Share on other sites

In your case above it should be

 

mail($to,$subject,$message, $headers, '-froot@mysite.com');

 

e.g

$header = "From: dave@hotmail.com' <Dave>\r\nCC: john@hotmail.com <John>\r\n";

mail('Bill.gates@microsoft.com', 'Windows7', 'This dosnt work', $header, '-froot@mysite.com');

 

Desmond

Link to comment
Share on other sites

In your case above it should be

 

mail($to,$subject,$message, $headers, '-froot@mysite.com');

 

e.g

$header = "From: dave@hotmail.com' <Dave>\r\nCC: john@hotmail.com <John>\r\n";

mail('Bill.gates@microsoft.com', 'Windows7', 'This dosnt work', $header, '-froot@mysite.com');

 

Desmond

 

Sorta.

 

The -f parameter is just a weird concatinating glob. Are you sending your e-mails from admin@yoursite.com? Make the parameter -fadmin@site.com for example.

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.