Answers.Body: <p>Transpires that the user under which the site runs had fsockopen listed as one of the PHP disable_functions. Removing that constraint solved the problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-17T09:34:07.517Z
Answers.LastActivityDate: 2024-03-17T09:34:07.517Z
Answers.UserDisplayName: Graham
Body: <p>I'm trying to get outbound mail set up. With CiviCRM 5.70.1 on PHP8.1, if I configure it to send via mail() then the test message works successfully, but I can see that my transactional emails, a membership receipt email is the one i'm interested in, is getting sent but is malformed (it's like bits of the metadata in the email are missing, resulting in a badly messed up message that is barely readable). I've seen the same thing on a different install, and that was resolved by sending out via SMTP instead, and in that case I get good results by configuring the SMTP settings to use to 'localhost' as my SMTP server on port 25 with no authentication. That's on a server currently running on PHP 7.4 and slightly older version of CiviCRM.</p>
  <p>Using the exact same settings on my 5.70.1 install, I get a fatal error. Looking in the logs I see in the CiviCRM log just this:</p>
  <p><code>[error] not connected</code></p>
  <p>and in my apache error log I see:</p>
  <pre><code>Got error 'PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /home/rp/sites/live/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function fsockopen() in /wp-content/plugins/civicrm/civicrm/vendor/pear/net_socket/Net/Socket.php:165
  </code></pre>
  <p>Clearly CiviCRM is not happy with what I'm providing by way of settings. But it doesn't seem to matter what I put in the SMTP settings fields - I  get the same fatal error regardless. Wondering if this is a bug in 5.70.1?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-01T21:21:14.113Z
Comments.Text: What do you have in php.ini for [allow_url_fopen](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) and/or is curl enabled in php.ini's extensions section?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-03-04T10:23:26.360Z
Comments.Text: allow_url_fopen is set to On. cURL support is enabled.
Comments.UserDisplayName: Graham
Tags: <smtp><outbound-email>
Title: What values are required in order to send outbound mail via SMTP?
ThreadText: # What values are required in order to send outbound mail via SMTP?
  
  (Asked by: username_0 on 2024-03-01)
  
  I'm trying to get outbound mail set up. With CiviCRM 5.70.1 on PHP8.1, if I configure it to send via mail() then the test message works successfully, but I can see that my transactional emails, a membership receipt email is the one i'm interested in, is getting sent but is malformed (it's like bits of the metadata in the email are missing, resulting in a badly messed up message that is barely readable). I've seen the same thing on a different install, and that was resolved by sending out via SMTP instead, and in that case I get good results by configuring the SMTP settings to use to 'localhost' as my SMTP server on port 25 with no authentication. That's on a server currently running on PHP 7.4 and slightly older version of CiviCRM.
  
  Using the exact same settings on my 5.70.1 install, I get a fatal error. Looking in the logs I see in the CiviCRM log just this:
  
  `[error] not connected`
  
  and in my apache error log I see:
  
  ```
  Got error 'PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /home/rp/sites/live/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Warning:  Undefined property: CRM_Admin_Form_Setting_Smtp::$_id in /wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php on line 2123
  PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function fsockopen() in /wp-content/plugins/civicrm/civicrm/vendor/pear/net_socket/Net/Socket.php:165
  
  ```
  
  Clearly CiviCRM is not happy with what I'm providing by way of settings. But it doesn't seem to matter what I put in the SMTP settings fields - I get the same fatal error regardless. Wondering if this is a bug in 5.70.1?
  
  **Tags:** smtp, outbound-email
  
  > **Comments:**
  > **username_1**: What do you have in php.ini for [allow_url_fopen](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) and/or is curl enabled in php.ini's extensions section?  
  > **username_0**: allow_url_fopen is set to On. cURL support is enabled.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-03-17. Score: 1
  
  Transpires that the user under which the site runs had fsockopen listed as one of the PHP disable\_functions. Removing that constraint solved the problem.
  
  
  ---
  
  