Send email by using form mail function

Send email by mail function

Many time when php mail function disabled on shared server, we can use following script to send an E-mail from shared web hosting account using contact form.

Three simple steps and you are ready with your new contact form.

Step 1 : Create FormMail.pl file under cgi-bin directory .

Download a FormMail.pl file in cgi-bin directory using following URL

Rename file from FormMail.txt to FormMail.pl

Step 2 : Create simple HTML contact form

<html>
<head>
<title>This is the test form</title>
</head>
<body>
<tr>
</p></td>
<form action=”/cgi-bin/FormMail.pl” name=”form1″ id=”form1″>
<input type=”hidden” name=”recipient” value=”info@your-domain.com” />
<input type=”hidden” name=”subject” value=”Test Form”>
<input type=”hidden” name=”redirect” value=”http://www.your-domain.com/thanks.html” />
<table width=”550″ border=”0″ align=”center”>
<tr>
<td width=”165″>Your email address:</td>
<td width=”375″><input name=”email” size=”30″ /></td>
</tr>
<tr>
<td>Your full name:</td>
<td><input name=”yourname” size=”35″ /></td>
</tr>
<tr>
<td>Town:</td>
<td><input name=”town” size=”20″ /></td>
</tr>
<tr>
<td>County:</td>
<td><input name=”county” size=”25″ /></td>
</tr>
<tr>
<td>Telephone:</td>
<td><input name=”telephone” size=”15″ />
if you would like to be phoned</td>
</tr>
<tr>
<td>Any access problems? </td>
<td><input name=”access” size=”35″ /></td>
</tr>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type=”submit” value=”Send request” /></td>
</tr>
</table>
</form>
</tr>
</table>
<table width=”770″ border=”0″ align=”center”>
<tr>
<td><hr /></td>
</tr>
<tr>
</tr>
</table>
<table width=”770″ border=”0″ align=”center”>
</table>
</body>
</html>

Step 3 : Create thanks.html redirect page and finalize the contact form.

<!DOCTYPE html>
<html>
<head>
<title>Thanks</title>
</head>
<body>

<h1>Thank you for getting in touch</h1>
<p>We appreciate you contacting us about our services. One of our colleagues will get back to you shortly.</p>

<p>Have a great day!</p>

</body>
</html>

Key points : Before testing a contact form, make sure that following changes made carefully else your contact form won’t work properly.

  1. Assign 755 permission to FormMail.pl file
  2. Change domain name in FormMail.pl file in following code

@referers = (‘your-domain.com’,’192.168.0.2′);

@recipients = &fill_recipients(‘info@your-domain.com’);

Let us know in our forum , if you have any question.

Post similar to this post : Send email using php mail function script

About Anant 373 Articles
Senior technical writer

1 Trackbacks & Pingbacks

  1. Send email by using phpmail function - KTCHost

Comments are closed.