I'm unable to send mail; it runs for a while but then returns:

Fatal error: Uncaught
PEAR_Exception: not connected in unknown on line unknown
- PEAR_Error: not connected in unknown on line unknown
Exception trace
#   Function    Location
0   CRM_Core_Error::exceptionHandler(Object(PEAR_Error))    unknown:unknown
1   call_user_func(Array, Object(PEAR_Error))   /var/www/slnmembers_drupal/sites/all/modules/civicrm/packages/PEAR.php:931
2   PEAR_Error->PEAR_Error('not connected', null, 16, Array, null)  /var/www/slnmembers_drupal/sites/all/modules/civicrm/packages/PEAR in /var/www/slnmembers_drupal/sites/all/modules/civicrm/CRM/Core/Error.php on line 901

PHP 5.6, MariaDB 5.5

  • Civi version 4.7.6
    – sterndata
    Apr 29, 2016 at 4:40
  • Additional information: The problem occurs if I"m trying to send mail through ssl://smtp.gmail.com, port 465, with a valid account and password. (It had been working.) it works now if I change the outgoing mail setting to mail()
    – sterndata
    Apr 29, 2016 at 5:07

1 Answer 1


Seems to be an error from PEAR Net_Socket, probably a few more lines of the backtrace would reveal that this came from Net_SMTP?

"Not connected" likely indicates that the remote SMTP connection has dropped the connection - this could be for a number of reasons, including intentional disconnection on that server's part ("whoah, 250 messages at once?!"), or an issue on that server, or even a network issue between CiviCRM and that server.

Since you say this is GMail, I'd guess that you might be running into intentional sending restrictions on Google Mail.

To keep our systems healthy and your accounts safe, Google Apps limits the amount of mail one user can send. Limits restrict the number of messages sent per day and the number of recipients per message. After reaching one of these limits, a user can't send new messages for up to 24 hours after the limit was exceeded, but they can still access their account and receive incoming email.

I don't recommend using Google SMTP for CiviMail, they will shut you down (even mid-connection!), because the service is not intended to be used as a bulk mail provider. That's not a bug, it's part of the package.

Switching to mail() method will work, but may also be limited by the hosting environment. For example, one popular webhost limits outbound emails to 150/hr and silently drops delivery of any mails beyond this. That's a situation where you might run a few test CiviMails successfully, then push out a large promo and be left confused at why the response was so poor ...

If you want to be assured of your CiviMail delivery, make sure you have established terms with your SMTP provider & make sure they accommodate the level of usage you need.

  • Thanks, Chris. I'll check on that, but this uses an account that is only used for sending and only sends mail in batches of 50 at a time, plus it also fails when sending the test email to one address. However, it's a start of things for me to look at.
    – sterndata
    May 1, 2016 at 1:28
  • 1
    Good luck! Odds are the SMTP server is returning an informative error message (perhaps swallowed by Net_SMTP) about the disconnection. If you can get that visible (either by modifying CiviCRM code or running your own tests from server) you might have more info. You can still run into Google's SMTP limits sending in batches of 50, and most services may block "suspicious activity" (including a spike in sends from an unknown origin) at will. May 1, 2016 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.