Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Casual emails sent via smtp:none:none://localhost:25 #61721
    microcompmicrocomp
    Participant

    Spoke too soon. Looks like this code resolves the error below, but not delivery issues from a contact form

    https://graph.microsoft.com/v1.0/me/sendMailresulted in a400 Bad Request` response: {“error”:{“code”:”InvalidInternetMessageHeader”,”message”:”The internet message header name ‘MIME-Version’ should start (truncated…)

    in reply to: Casual emails sent via smtp:none:none://localhost:25 #61709
    microcompmicrocomp
    Participant

    So after spending some time trying to figure this out, we have found a workaround, while the good people of Post SMTP are looking into a more permanent solution. This basically removes the auto generated email headers. Add this to your site’s functions.php and test, should work:

    //remove the automatically generated email headers
    function remove_auto_email_header( $args ) {
      $headers = array();
      foreach ( $args['headers'] as $header ) {
        if ( false === strstr( $header, 'Auto-Submitted' ) ) {
          $headers[] = $header;
        }
      }
      $args['headers'] = $headers;
      return $args;
    }
    add_filter( 'wp_mail', 'remove_auto_email_header', 10, 1 );
Viewing 2 posts - 1 through 2 (of 2 total)
Scroll to Top