There is a wordpress installation installed on a cpanel account. They have a contact form on that wordpress installation that is sending using the php mail function. It is supposed to be sending like this:
noreply@cpanel_example.com -> info@cpanel_example.com
But it is sending like this, using the servers hostname with the cpanel username and the email account name.
email@example.com_example.com -> info@cpanel_example.com
What is causing this?
So I added a plugin in WordPress which allowed the php mail function to send from
wordpress@cpanel_example.com. I don't know how it did this though. So I feel the issue is with the default php mail function sender address.
*Edit 2 (example php code)
<?php $to = 'info@cpanel_example.com'; $subject = 'The test for php mail function'; $message = 'Hello'; $headers = 'From: noreply@cpanel_example.com' . "\r\n" . 'Reply-To: firstname.lastname@example.org' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers);
*Edit 3 (wordpress plugin used that allowed the emails to be sent from
https://wordpress.org/plugins/wp-mail-smtp/ SETTINGS From Email: BLANK (default address used: email@example.com) Mailer: Default (none) Return path: checked