Hello,
I am having a problem with my mail script.
Basically I wish it to perform a simple mail function. I have it to send the recipient 4 text boxes and one drop down list selection.
My problem lies in the fact that when I test this email, the subject is fine (as it is hardcoded), however the sender says it is from "CGI-Mailer" with a reply to address of the host server (where ever that may be).
My code looks like this:
HTML form
and my PHP looks like this:
When I receive a mail, the format is like this:
Subject reads "Website Enquiry" and the sender is "CGI-Mailer"
Everything else is formatted correct. I have tried moving parts around, but if I change the order of the to, subject and message, the whole layout of the received email goes wrong.
If anyone can shed any light on this, I would greatly appreciate it 8)
Thanks in advance!!
Dan
I am having a problem with my mail script.
Basically I wish it to perform a simple mail function. I have it to send the recipient 4 text boxes and one drop down list selection.
My problem lies in the fact that when I test this email, the subject is fine (as it is hardcoded), however the sender says it is from "CGI-Mailer" with a reply to address of the host server (where ever that may be).
My code looks like this:
HTML form
Code:
<form action="send.php" method="post">
<p>Name</p>
<p><input type="text" name="name" maxlength="40"></p>
<p>Phone</p>
<p><input type="text" name="phone" maxlength="14"></p>
<p>Email</p>
<p><input type="text" name="email" maxlength="40"></p>
<p>Type of site</p>
<p><select name="type">
<option value="No option selected">Please select an option...</option>
<option value="Option one">Option 1</option>
<option value="Option two">Option 2</option>
<option value="Option three">Option 3</option>
<option value="option 4 :D">option 4</option>
<option value="option five">option 5</option>
</select></p>
<p>Additional Information</p>
<textarea name="comments" rows="10" cols="40"></textarea>
<input name="submit" type="submit" value="send">
</form>
and my PHP looks like this:
Code:
<?php
@extract($_POST);
//$from = "From: $name < $email >";
$sentby = "Quote / Enquiry requested by:\n$name < $email >\nPhone number: $phone\n\nType of site: $type";
mail('dan@mysite.co.uk','Website Enquiry',$comments,$sentby);
?>
When I receive a mail, the format is like this:
Subject reads "Website Enquiry" and the sender is "CGI-Mailer"
Everything else is formatted correct. I have tried moving parts around, but if I change the order of the to, subject and message, the whole layout of the received email goes wrong.
If anyone can shed any light on this, I would greatly appreciate it 8)
Thanks in advance!!
Dan