2009-12-09, 06:13 AM
Hey All, I like a few others here had trouble with my PHP mail() function not working correctly. So, I did some digging around and was able to fix my problem, while still keeping all the functionality of the improved mailing system that myBB offers.
The reason that the PHP mail() function was not working for me is because myBB uses "\n" for new line breaks when using the PHP mail() function. I am on a Windows Hosting and it uses stricter mail protocols and requires that new lines be denotated with "\r\n" rather than "\n".
If you are experiencing problems with your mail() function, try these steps to fix it.
1. Open your /inc/mailhandlers/php.php.
2. Find this code
3. Replace it with this code
4. Find this code
5. Add this code above it
6. Save it and upload it to your website.
It worked for me, maybe it will work for you too. Good luck!
The reason that the PHP mail() function was not working for me is because myBB uses "\n" for new line breaks when using the PHP mail() function. I am on a Windows Hosting and it uses stricter mail protocols and requires that new lines be denotated with "\r\n" rather than "\n".
If you are experiencing problems with your mail() function, try these steps to fix it.
1. Open your /inc/mailhandlers/php.php.
2. Find this code
$this->sendmail = @ini_get('sendmail_path');
if($this->sendmail)
{
$this->headers = str_replace("\r\n", "\n", $this->headers);
$this->message = str_replace("\r\n", "\n", $this->message);
$this->delimiter = "\n";
}
3. Replace it with this code
$this->sendmail = @ini_get('sendmail_path');
if($this->sendmail)
{
$this->delimiter = "\r\n";
}
4. Find this code
if(ini_get('safe_mode') == 1 || strtolower(ini_get('safe_mode')) == 'on')
{
$sent = @mail($this->to, $this->subject, $this->message, trim($this->headers));
}
else
{
$sent = @mail($this->to, $this->subject, $this->message, trim($this->headers), $this->additional_parameters);
}
5. Add this code above it
$this->message = str_replace("\n", $this->delimiter, $this->message);
6. Save it and upload it to your website.
It worked for me, maybe it will work for you too. Good luck!