Hi @mbogh77.
Looks like, somehow, you managed to get an invalid email address all the way through the wp_mail() function.
____@https://____.com
From my understanding, the “https://” is what’s invalidating it.
It’s possible it’s getting set at https://github.com/WordPress/WordPress/blob/4.7.1/wp-includes/pluggable.php#L263-L269
It’s also possible you’re getting it to https://github.com/WordPress/WordPress/blob/4.7.1/wp-includes/pluggable.php#L317-L332 and the parsing isn’t managing to catch the “https://” to remove it.
This is the line that is trying to use the value you’re getting through: https://github.com/WordPress/WordPress/blob/4.7.1/wp-includes/pluggable.php#L352
I’m not sure if this is something I’m going to be able to troubleshoot to help prevent from our plugin, to be honest, but worth a shot as time permits. All you did was get the SSL certificate, and then try to use the plugin and start receiving signups etc? Trying to make sure I have everything needed to recreate on my own.
As a possible hotfix for you, you could do something like the following:
function mbogh_email_bpro_hotfix( $email ) {
if ( false === strpos( $email, 'https://' ) ) {
// Nothing found, return untouched.
return $email;
}
//We found something, let's remove it.
return str_replace( 'https://', '', $email );
}
add_filter( 'wp_mail_from', 'mbogh_email_bpro_hotfix' );
You’ll want to add this to your theme’s functions.php, and look it over to make sure this is matching up appropriately with what you’re actually seeing in your error logs.
hmmm, this is strange. I have replied but I cannot see the message I wrote to you – I hope you have received it.
Only replies I’ve seen come through have been trying to debug why you couldn’t see a previous reply.
I have tried again and still it will not let me post the reply and then I get this message:
ERROR: Duplicate reply detected; it looks as though you’ve already said that!
I am not doing so well here :0(
Shoot – ok I try again thank you.
So the site was running originally in non SSL (http). We had cloudflare running and BP registration options – everything was working perfectly. Then I followed this article to set up SSL using cloudflare: https://jonnyjordan.com/blog/how-to-setup-cloudflare-flexible-ssl-for-wordpress/
It was after this step we started seeing the error.
I then removed the 2 plugins suggested in the article and stopped cloudflare – reverted to http and everything was fine again.
Sorry, there is more but again it will not let me post the next part of the message.
Then I took the more traditional approach using a certificate installed on our server / host.
I followed an article but cannot give the link as it keeps refusing the post.
Anyway the result is that the error is back again.
Here is the full error message if that helps with further diagnosis – reads as follows:
Fatal error: Uncaught exception ‘phpmailerException’ with message ‘Invalid address: (setFrom) notifications@https://www.________.com’ in /______/wp-includes/class-phpmailer.php:1023 Stack trace: #0 /_____/wp-includes/pluggable.php(352): PHPMailer->setFrom(‘notifications@h…’, ‘The website’, false) #1 /_____/wp-content/plugins/bp-registration-options/includes/admin.php(303): wp_mail(‘caseyasay777@ya…’, ‘Membership Appr…’, ‘Welcome caseyas…’) #2 [internal function]: bp_registration_options_form_actions(”) #3 /_____/wp-includes/class-wp-hook.php(298): call_user_func_array(‘bp_registration…’, Array) #4 /_____/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(”, Array) #5 /_____/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #6 _____/wp-admin/admin.php(154): do_action(‘admin_ in /_____/wp-includes/class-phpmailer.php on line 1023
Your first reply is great, I will try the links you have provided and see how far I can get. Thank you.
Upon coming back to this thread, I’m pretty confident the issue is coming from https://github.com/WordPress/WordPress/blob/4.7.1/wp-includes/pluggable.php#L326
My hunch is that the $_SERVER['SERVER_NAME'] value is somehow getting set to be a full URL instead of just www.domain.com or domain.com, and that’s tripping things up, resulint in the $from_email being set to wordpress@https://domain.com which is invalid due to my previous point.
This also makes sense since you’d be trying to change things to properly handle SSL certificates, it just may be touching on places it shouldn’t.
Hi Michael – I had a good read on the links you provided and started digging into the underlying code. I actually did a hard set of the $from_email variable in the pluggable.php file and then worked my way through testing and following the error – but whatever I did the email address kept getting re-written with https in there. The I remembered that way back when we first set the site up I had added some code to the functions.php to modify the from email address following this article: https://premium.wpmudev.org/blog/wordpress-email-settings/
Removing that code alone has fixed / resolved the error – everything else is now back as it was an we are running with SSL ! ! !
Thank you so much for taking the time to help me get to the bottom of it. Hopefully this little thread may help someone else in the future.