Sending failed using mail() as PHP's default mail()

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Sending failed using mail() as PHP's default mail()

Post by anjanesh »

Code: Select all

[14-Feb-2008 17:35:54] PHP Fatal error:  Uncaught exception 'Swift_ConnectionException' with message 'Sending failed using mail() as PHP's default mail() function returned boolean FALSE.' in /var/www/vhosts/my-domain.com/httpdocs/lib/Swift/Plugin/MailSend.php:166
Stack trace:
#0 /var/www/vhosts/my-domain.com/httpdocs/lib/Swift/Plugin/MailSend.php(146): Swift_Plugin_MailSend->doMail('mail@CarCr...', 'Subject', '<html><head><ti...', Object(Swift_Message_Headers), '-oi -f noreply@...')
#1 /var/www/vhosts/my-domain.com/httpdocs/lib/Swift.php(171): Swift_Plugin_MailSend->sendPerformed(Object(Swift_Events_SendEvent))
#2 /var/www/vhosts/my-domain.com/httpdocs/lib/Swift.php(462): Swift->notifyListeners(Object(Swift_Events_SendEvent), 'SendListener')
#3 /var/www/vhosts/my-domain.com/httpdocs/script-2.php(101): Swift->send(Object(Swift_Message), 'mail@e-CarCr...', Object(Swift_Address))
#4 /var/www/vhosts/my-domain.com/httpdocs/script-2.php(69): sendMail()
#5 /var/www/vhos in /var/www/vhosts/my-domain.com/httpdocs/lib/Swift/Plugin/MailSend.php on line 166
 
Using NativeMail because SMTP through another domain on another server is somehow blocked.
But even NativeMail isnt working on this particular server.
Is there I need to check for for mail() ? Possibly something that blocking port 25 ?

Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Sending failed using mail() as PHP's default mail()

Post by Chris Corbyn »

Sounds like mail() is disabled or not configured in php.ini. What happens when you try a simple mail() script?
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Re: Sending failed using mail() as PHP's default mail()

Post by anjanesh »

Code: Select all

ini_set("display_errors", "1");
error_reporting(E_ALL + E_STRICT);
.
.
.
if (!mail($to, $subject, $message, $headers))
 echo "Couldnt mail";
Oddest thing - when run in the browser, it shows Couldnt mail.
But in shell, nothing - no error - no msg - nothing.

How do I trace this ?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Sending failed using mail() as PHP's default mail()

Post by Chris Corbyn »

What if you put an else in there? It's probably succeeding in the shell (since it won't be reading from php.ini and will assume defaults).
Post Reply