If your host has disabled it, only your host can enable it.
If your host has disabled it, only your host can enable it.
If you are your own host:
http://us2.php.net/function.mail
http://us4.php.net/manual/en/function.mail.php
You could also be running PHP in safe mode (which apparently disables mail).
http://us4.php.net/manual/en/features.safe-mode.php
Well, I suspect the prob is somewhere deeper.
A test script from exampe at your URL worked fine, regardless of safe_mode directive. The wordpress function didn’t. Looking for user permissions…
OK, understood.
PHP invokes sendmail directly! Odd idea. Sendmail binary can’t be called directly by user nobody. Period.
Now looking for a stub that does mail submission via socket.
Replaced wp_mail function to the following. Works fine.
————————————————————————————–
function wp_mail($to, $subject, $message, $headers = ”, $more = ”) {
if( $headers == ” ) {
$headers = “MIME-Version: 1.0\n” .
“Content-Type: text/plain; charset=\”” . get_settings(‘blog_charset’) . “\”\n”;
}
include_once ‘Net/SMTP.php’;
$host = “my.smtp.host”;
$port = 25;
$from = “donotreply@my.web.site”;
$text_headers = “From: $from\nTo: $to\nX-Mailer: Socket Mailer\nSubject: $subject\n$headers”;
if (!($smtp = new Net_SMTP($host, $port))) { return false; }
if (PEAR::isError($smtp->connect())) { return false; }
if (PEAR::isError($smtp->mailFrom($from))) { return false; }
if (PEAR::isError($res = $smtp->rcptTo($to))) { return false; }
if (PEAR::isError($smtp->data($text_headers . “\n” . $message))) { return false; }
$smtp->disconnect();
return true;
}
Allow me to add one more possible solution. I found out that my hoster’s mail()-function does not accept the fifth argument in brackets. AFAIK it’s usually used to override the “Return-Path”-settings.
Anyways, this one worked for me:
[code]
function wp_mail($to, $subject, $message, $headers = '') {
if( $headers == '' ) {
// You might want to adjust this
$from = "From: Your Blog <mailhandle@domain.tld>";
$headers = "$from" . "MIME-Version: 1.0\n" .
"Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
}
return @mail($to, $subject, $message, $headers);
}
[/code]
Ok, I have a similar issue, but I am almost positive it is due to the fact that my email server requires a login (ESMTP). How do I get wordpress to send emails via that server using ESMTP/login authentication?
I was having similar problems with sending emails till I came across XMail. It solved all my mail related problems with just a few steps. See these sites:
http://xmailserver.org/
http://www.halfdone.com/Articles/XMailInstall/
Cheers,
http://www.jawid.info