Hosting: (INGLES) How to configure Contact Form hosted with us

Hosting: (INGLES) How to configure Contact Form hosted with us

Probably the main issue that email service providers face is spam. Therefore email service providers and hosting companies have to manage different anti-spam services/ filters and put restriction in order to prevent sending spam from their servers and protect their customers and other users.

Our email service is configured to check public spam lists, such as SpamCop, SpamHaus, etc. We also have SpamAssassin installed on our servers which you can easily enable and configure through your cPanel. Check How to configure SpamAssassin article for more information. Recently we have implemented a new feature on our shared servers called Rewrite From: header to match actual sender. It was done to improve the validation of email senders on our servers that will allow us to deal with spamming activity more efficiently in this way.

Also we have disabled sending emails from email address on the domain that does not exist on the server or uses third-party email service at the moment. We have taken these measures due to mass SPAM sending through forums, guest books, and contact form scripts on our servers.

And since many customers have contact forms at their web-sites configured for using third-party email accounts or services, sometimes it might have resulted in improper functionality of mail forms and similar services, unfortunately.

Sometimes when you use Gmail, Outlook or Yahoo email address on a website contact form the attempt to access your account may be blocked. This is because some of the most popular free email services reject successful login attempts, originating from unusual locations.

In this guide you will find tips and tricks on how to temporary disable this restriction or add our server to whitelist. The instructions provided in this article should help you to create and smoothly use your contact form for a web-site hosted with Namecheap. 



Email account should be created on our hosting server

If you have PHP mail contact form it sends emails from our server to your account. But to send emails from our server, domain should be added to it and have MX records pointed to the server where this domain is hosted. So if you use Google Apps, Wix or any other third-party services for your domain it will not be possible to send emails from or server using this domain name.

You may point your domain to our server’s MX records or you can leave custom records for your domain and use third-party service with it. But then create subdomain and point it to our server’s

And then you can use in your php form with email account created using your subdomain.

You can manage your records in cPanel > MX Entry menu: 


1. For domain you are going to use with your mail form Email Routing should be set to Local Mail Exchanger: 



2. You may create MX record pointed to your main domain (if it is pointed to the server IP) or directly to the server. You can find server name using this article: 



This is first and main condition for sending emails from hosting server. With these settings your domain is correctly pointed to hosting server’s mail service and ready to use PHP mail form. 


FROM field in PHP script for mail form


In order to avoid issues related to spam it is possible to use in FROM field only email hosted at our servers. So as a result you create contact form only using REPLY TO field for the domain which is not hosted with us and FROM field for the domain name hosted on our servers in mail headers.

If you have PHP script for mail form, you need to change your script's settings. In order for your scripts to work as intended, you need to set the FROM field to an email address that you have created under your cPanel account.

We will use from@yourdomain.tld email address as an example further. Regularly PHP scripts have settings similar to the following ones:

$email_from = $_POST['email'];
$email_from = "you@yourdomain.com"; 
$headers = "From: $post_email"; etc.

All these values use some third-party emails or variable values with email taken from 'your email address' field in contact form.
Thus you may set From: or $email_from to use email account created on the server as it is described above.

Below you can check the sample of a simple code you can use in PHP script to create your mailform: 


$mail_to_send_to = "name@anydomain.tld"; 
$your_feedbackmail = "from@yourdomain.tld"; 
$sendflag = $_REQUEST['sendflag'];                       
if ( $sendflag == "send" )
        {
                $email = $_REQUEST['email'] ;
                $message = $_REQUEST['message'] ;
                $headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $email" . "\r\n" ;
                $a = mail( $mail_to_send_to, "Feedback Form Results", $message, $headers );
                if ($a) 
                {
                     print("Message was sent, you can send another one");
                } else {
                     print("Message wasn't sent, please check that you have changed emails in the bottom");
                }
        }
?>