Answers.Body: <p>Very simple: despite of Cpanel new email account &quot;Welcome&quot; email states SMTP port to use is 465, it is actually <strong>587</strong>.</p>
  <p><em>No sense in asking why CiviCRM throws MySQL/DB connection error instead of &quot;wrong SMTP credentials&quot; notification, nor why wrong SMTP port information arrives from Cpanel.</em></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-15T11:58:52.173Z
Answers.LastActivityDate: 2023-07-15T11:58:52.173Z
Answers.UserDisplayName: yurg
Body: <p>cross-related: <strong><a href="https://civicrm.stackexchange.com/questions/45259/sender-email-converts-from-senderdomain-tld-to-b-16-16-229f5073c3f9ee97domain">Sender email converts from sender@domain.tld to b.16.16.229f5073c3f9ee97@domain.tld</a></strong></p>
  <p>The title says it all: saving Outbound Mail settings with SMTP username containing &quot;@&quot;,
  extended log message says</p>
  <pre><code>      SELECT * FROM  civicrm_setting 
        WHERE (  civicrm_setting.name  = mailing_backend )  
        AND (  civicrm_setting.domain_id = 1 ) 
        AND (  civicrm_setting.is_domain = 1 )  
        [nativecode=2027 ** Malformed packet]
  </code></pre>
  <p><em>Drupal 9.5.10, PHP 8,2, CiviCRM 5.63.1</em></p>
  
Tags: <civimail><mailing><smtp><drupal-9>
Title: "DB Error: no database selected" error if Outbound Mail SMTP username contains @
ThreadText: # "DB Error: no database selected" error if Outbound Mail SMTP username contains @
  
  (Asked by: username_0 on 2023-07-13)
  
  cross-related: Sender email converts from sender@domain.tld to b.16.16.229f5073c3f9ee97@domain.tld
  The title says it all: saving Outbound Mail settings with SMTP username containing "@",
  extended log message says
        SELECT * FROM  civicrm_setting 
        WHERE (  civicrm_setting.name  = mailing_backend )  
        AND (  civicrm_setting.domain_id = 1 ) 
        AND (  civicrm_setting.is_domain = 1 )  
        [nativecode=2027 ** Malformed packet]
  
  Drupal 9.5.10, PHP 8,2, CiviCRM 5.63.1
  
  **Tags:** civimail, mailing, smtp, drupal-9
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-07-15. Score: 1 | Accepted answer
  
  Very simple: despite of Cpanel new email account "Welcome" email states SMTP port to use is 465, it is actually **587**.
  
  *No sense in asking why CiviCRM throws MySQL/DB connection error instead of "wrong SMTP credentials" notification, nor why wrong SMTP port information arrives from Cpanel.*
  
  
  ---
  
  