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…)
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 );