Answers.Body: <p>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?</p>
  
  <p>"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.</p>
  
  <p>Since you say this is GMail, I'd guess that you might be running into intentional <a href="https://support.google.com/a/answer/166852?hl=en" rel="nofollow">sending restrictions on Google Mail</a>.</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>Switching to <code>mail()</code> method will work, but may also be limited by the hosting environment. For example, one popular webhost limits outbound emails to 150/hr <em>and silently drops delivery of any mails beyond this</em>. 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 ...</p>
  
  <p>If you want to be assured of your CiviMail delivery, make sure you have established terms with your SMTP provider &amp; make sure they accommodate the level of usage you need.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-01T01:28:45.020Z
Answers.Text: 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.
Answers.UserDisplayName: sterndata
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-01T02:26:17.897Z
Answers.Text: 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.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-01T01:12:33.953Z
Answers.LastActivityDate: 2016-05-01T01:23:02.430Z
Answers.LastEditDate: 2016-05-01T01:23:02.430Z
Answers.UserDisplayName: Chris Burgess
Body: <p>I'm unable to send mail; it runs for a while but then returns:</p>
  
  <pre><code>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-&gt;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
  </code></pre>
  
  <p>PHP 5.6, MariaDB 5.5</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T04:40:48.087Z
Comments.Text: Civi version 4.7.6
Comments.UserDisplayName: sterndata
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T05:07:25.287Z
Comments.Text: 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()
Comments.UserDisplayName: sterndata
Tags: <civimail>
Title: CiviMail not working
ThreadText: # CiviMail not working
  
  (Asked by: username_0 on 2016-04-29)
  
  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
  
  **Tags:** civimail
  
  > **Comments:**
  > **username_0**: Civi version 4.7.6  
  > **username_0**: 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()  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-01. Score: 2
  
  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](https://support.google.com/a/answer/166852?hl=en).
  
  > 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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_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.  
  
  ---
  
  