How to configure Contact Form hosted with us

Email Service. Benefits and possible issues

Email has become an integral part of our lives. This simple service has closed distances and brought the world together. Other countries do not seem to be that far away anymore because communication has become that much faster. It helps to save both time and money.

Email service becomes a powerful advertising tool as well. It allows you to form a circle of loyal customers and boost business performance. But unfortunately, with the number of benefits come issues as well. Spam, spam-advertising, fraudulent and phishing messages, etc.

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");
                }
        }
?>


 
  Your Email:

  Message:

 

 

It creates simple contact form window:

  mailform3.jpg


1. In 'Your Email' field visitor can specify 'feedback' email and it will be send in 'Reply To'. So once you click on 'reply to' in your email client – address from this field will be set.

$email = $_REQUEST['email'] ; - is where email is set

Reply-To: $email" . "\r\n" ; - is string to put this address in 'Reply To'

2. Message will be sent to name@anydomain.tld email address as it is set in:

$mail_to_send_to = "name@anydomain.tld";


And from from@yourdomain.tld according to:

$your_feedbackmail = "from@yourdomain.tld";



Also, you can use simple contact form configured for our servers.


Contact Form VS WordPress



WordPress powers approximately 50% of all the websites online around the world. So contact form for WordPress is very important tool as well.

We recommend  that you use Contact-Form-7 plugin for creating contact form at your WordPress site. Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.

By default this plugin sends email from default cPanel email account. However if you use some other plugin and face any issues with contact form, you can install SMTP plugin to force your WordPress send mails from account created on the server.

You can use WP-Mail-SMTP plugin. It reconfigures wp_mail() function to use SMTP instead of mail() and creates an options page that allows you to specify various options:


mailform9.jpg

From Email: you can specify the email address from which emails are sent, it should be created in your cPanel account
From Name: name displayed in the emails sent
Mailer: select Send all WordPress emails via SMTP.
SMTP Host: localhost (or specify servername, you can find server name with this article)
SMTP Port: 465 for use SSL encryption and 587 for use TLS option
Authentication: Yes, use SMTP authentication
Username: full emails address same as From Email
Password: password from this email account

With these settings your WordPress plugins will send emails from our server correctly.


Contact form VS another CMS

Actually settings for most CMS are similar to WordPress and SMTP plugin. We will show example with MotoCMS and contact form plugin for this content management system:

mailform99.jpg

Email Source: this field is for email account hosted with Namecheap and created in cPanel
Email to: here you can specify email account where all messages from contact form will be sent, it could be any address hosted on the server or not
Use SMTP sever: should be checked
Port: 465 (and then Secure SMTP connection SSL)
Authentication type: login
SMTP Username: full emails address same as From Email
Password: password from this email account


That's it!

              
                      Need any help? Contact our HelpDesk

Comments

We welcome your comments, questions, corrections and additional information relating to this article. Your comments may take some time to appear. Please be aware that off-topic comments will be deleted.

If you need specific help with your account, feel free to contact our Support Team. Thank you.

Need help? We're always here for you.

× Close