I have been having trouble with the emails I send from my wordpress site. Everything comes from “info@mydomain.co.za via default@hostingprovider.net”
The via part looks really untidy and unprofessional. From past experience I know that this has to do with the Sender not being set. I searched for the setting to change this in WordPress but to no avail. It seems that it can not be set.
You can automatically set the sender by adding this code to functions.php (or putting it in a plugin):
This has the same effect as Talon’s answer, but avoids editing core WordPress files. This way the change survives a WordPress upgrade.
https://codex.wordpress.org/Plugin_API/Action_Reference/phpmailer_init
So after a bit of searching I managed to find the bit of code that needs to be changed.
Open the file:
/wp-includes/pluggable.php
Find the lines that look like this:
And add the following:
So it should now look like this:
This will prevent the “via unwanted@host.net” and will not just come from you.
BEWARE:
This may cause spam issues IF your email address is different from your domain name.
ie:
I hope this saves someone out there an hour or 2 like I just wasted.