Knowledgebase Home / emails are sent from user@servername.com and not an actual email address

emails are sent from user@servername.com and not an actual email address


Quick Steps:

  • It is necessary to use a valid From: field in email header.
  • Change the script  to use a valid header.
  • The issue will then be resolved.

This is because our servers require you (or your script) to use a properly formatted, valid From: field in the email’s header. If the From: field is not formatted correctly, empty or the email address does not exist in the cPanel, the From: address will be changed to username@serverhostname.com

You must change the script you are using to correctly use a valid From: header.

Examples of headers that should work would be:

From: user@somedomain.com will work
From: "user" <user@somedomain.com>

Examples of headers that will NOT work:

From: "user@somedomain.com"
From: user @ somedomain.com
From: user@somedomain.com <user@somedomain.com>

Note: if the above options do not set the sender correctly, please refer to the lower portion of this article in regards to the headers.

Our servers will not accept the name for the email address and the email address to be the same. It will not accept a double declaration of the email address.

If you comfortable editing your PHP mailing scripts, you can also modify the sendmail_path line located in a custom php.ini. You would want to modify it  to use a line like this example below. The part that you will be adding is: -f’user@domain.com’

sendmail_path = /usr/sbin/sendmail -t -i -f'user@domain.com'

This should work because the php mail function calls sendmail (a program on the server) directly using the path defined in your php.ini. Placing the -f flag here allows us to work directly with sendmail. Passing a “From” header to the php mail function will override the -f flag set in your php.ini.

If the above steps still do not make your form send as the appropriate email address, you may need to add the following headers:

$headers = 'From: email@yourdomain.com' . " " .
'Reply-To: email@yourdomain.com' . " " .
'X-Mailer: PHP/' . phpversion();

You may also need to use the -f flag in the event the headers are still not being added correctly:

mail($to, $subject, $body, $headers, '-femail@yourdomain.com');

For content management systems like Joomla and WordPress, you will need to follow their documentation for formatting the from fields properly per their requirements. WordPress will require the Mail From plugin.

Contact form with basic spam protection:

We have provided a basic contact form that you can use. The form has two files that you will need to place in your hosting account. You will need to modify the “email-form.php” file to suite your needs. *please note: this form is provided as a courtesy & we provide no support for modifying it or provide support for coding.

example-contact-form.zip

*Note: While our staff will attempt to provide a best effort in providing support for your scripts, we do not provide coding support. In the event your scripts are out of date or not properly coded, you will need to consult with a developer.

We'd love to hear your thoughts. How can we make this better?
Yes
No
Powered by Helpful

If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look.

Looking for better web hosting? Sign up today and take 50% off your first month with promo code: 1stmonth50

Our Guiding Principles

  • Provide consistent, stable and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.