Web Hosting Knowledge Base

Knowledge Base » General Information » How to get an existing contact form to work?4 min read

How to get an existing contact form to work?4 min read

If you have a PHP contact form that is unable to send messages, try the solution provided below.

Open your contact form’s PHP file in a text editor and insert the following code into it:

 $mymail = 'youremail@yourdomain.com';
 $headers = 'From: Contact Form <$myemail>\r\n';
 $headers .= 'Reply-To: $name <$email>\r\n';
 mail($mymail, $subject, $message ,$headers);

 

Save the changes you have just made, and then run your script in a browser to test its sending capabilities.

Note: Make sure you replace youremail@yourdomain.com with a valid e-mail address created through our system. If you have not yet had a chance to set up an e-mail address on your AwardSpace mail server, please review our How to create an email account? article for more information on how to craete an e-mail ID.

The above code basically sets the e-mail address entered in the contact form to be set as “Reply-To” header and you set your e-mail address created through our system as a sender (“From” header).

 

It is important to note that these changes need to be added to the $headers variable, so it is vital that you add them to the PHP mail() function.

 

If your PHP script already contains the $header or $headers variables, you will have to add the same code but with a small tweak:

 $mymail = 'youremail@yourdomain.com';
 $headers .= 'From: Contact Form <$myemail>\r\n';
 $headers .= 'Reply-To: $name <$email>\r\n';
 mail($mymail, $subject, $message ,$headers);

 

Basically, you will need to put a dot (.) between the $headers variable and the equal sign.

Again, make sure you replace youremail@yourdomain.com with a valid AwardSpace e-mail account.

AwardSpace on Social Media

It's Time to Share Your Story.

Get Free Web Hosting. Start a website, and introduce yourself to the world.

Share This

Share This

Share this post with your friends!