Yesterday, I spent some time figuring out how to add my own PHP code to make an email contact form work properly. Unfortunately, PHP’s mail() function didn’t work for Bluehost servers hosting the contact form on my site. There seems to be some special code required for Bluehost. Here’s what worked for me:

  1. Set up your typical contact form within <form> tags.

  2. Set you <form>’s action to point to Bluehost’s BlueMail and make the opening tag look like the following:

<form action="" enctype="multipart/form-data" method="POST">
3. Set the email address that you want to send to:
<input type="hidden" name="sendtoemail" value="">
NOTE: Using this method, you can only send email to a Bluehost email address Ex: would work because it is hosted by Bluehost servers. Using a Gmail address did not work.
4. (Optional) Change the redirect after user clicks the submit button:
<input type="hidden" name="redirect" value="">
Here’s a very simple example for working code, no PHP file required with this Bluehost method:
<form action="" enctype="multipart/form-data" method="POST">
    <input type="text" name="name" id="name" placeholder="Name" />
    <input type="text" name="email" id="email" placeholder="Email" required />
    <textarea name="message" id="message" placeholder="Message" required></textarea>

    <input type='hidden' name='cgiemail-mailopt' value='sync' />
    <input type="hidden" name="sendtoemail" value="" />
    <input type="hidden" name="subject" value=" - Contact Form" />
    <input type="hidden" name="redirect" value="" />
    <input type="submit" value="Send Message" class="button form-button-submit" />
All information in within the form tags will be send to the designated email address. You can find more information and keywords at the source mentioned below.

Source: In your Bluehost’s cPanel, navigate to “CGI Center” and choose BlueMail so that you can see more information regarding this issue. If you are logged in, then you might be able to use <link>.

 - Danial Goodwin -
Co-Founder and Lead Developer for Simply Advanced, LLC