Is there a way to make PHP.ini mail() function send from the actual website domain name.
I have added all the usual a records to stop the emails being marked as spam, but the last thing to get the email to do is make it send from the actual website its self and not the server address.
Looking in google, it displays the from email address, but then it says via [servername]. Is there a way for this not to happen?
It is possible to set the “From” address when using PHP’s mail() function, though you would need to configure that in the app that is using the mail() function.
You can see an example of doing that in the documentation here:
This is already set including these headers, but for the likes of gmail, it states “via” [tdl.servername] in the from line, which I dont want to happen on a shared server.
I would just like the email to come directly from the domain its sent from.
Again, wouldnt this just sent it directly from one account? I.E. one main server account, when this is a shared hosting server, with many different domain names running on it.
I suppose for the one using php mail() i could set the ini up for that website, but wouldnt want to go into every single instance to change this, unless it can be changed upon server creation?
If you are using mod_php then yes, the main /etc/php.ini file would apply to all sites. If you are using fcgi or cgi then each site has it’s own php.ini file under /home/siteadminname/etc/php.ini The default setting for Virtualmin is to run PHP with fcgi
Most people now consider it a bad idea to run a shared hosting server with mod_php
If neither of these work for you however, you can set this via htaccess.