Email form

Hi there,

I am quite new to php although I am learning more each time!

I am trying to send an email form with out using mail to.

It is a complex form as it is for print quotes.

I need the text to come in as plain text.

All the tutorial I have tried, don’t quite work for me.

Although I have set one up (using a tutorial) that did work, but is html.

Here is the code:

<?php /* Subject and email variables */ $emailSubject = 'ABC Printing Quote'; $webMaster = '[email protected]'; /* Gathering Data Variables */ $name = $_POST['name']; $lastname = $_POST['last_name']; $company = $_POST['Company']; $phone = $_POST['Phone']; $fax = $_POST['Fax']; $email = $_POST['Email']; $address = $_POST['Address']; $jobdescription = $_POST['job_description']; $quantities = $_POST['quantities']; $typeofpaper = $_POST['type_of_paper']; $colour = $_POST['colour']; $inkcolour = $_POST['ink_colour']; $sides = $_POST['sides_printed']; $finishing = $_POST['finishing']; $filessupplied = $_POST['files_supplied']; $body = <<<EOD

Name: $name
Last Name: $last_name
Company: $Company
Phone: $Phone
Fax: $Fax
Email: $Email
Address: $Address
Job Description: $jobdescription
Quantities: $quantities
Type of Paper: $typeofpaper
Colour Paper: $colour
Ink Colour: $inkcolour
Sides: $sides
Finising: $finishing
Files Supplied: $filessupplied
EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Resluts rendered as html */ $results = <<<EOD Thanks for you Quote Request!
Thank you for your interest! Your email will be answered very soon!
EOD; echo "$results"; ?>

Thanks!
Leslee

You need to take all of the HTML out of the message body. Than’s the [tt]
[/tt] tags in the body variable. If there is any HTML assigned to any of the other variables used in this command, you need to take it out, too.
[php]
$body = <<<EOD



Name: $name

Last Name: $last_name

Company: $Company

Phone: $Phone

Fax: $Fax

Email: $Email

Address: $Address

Job Description: $jobdescription

Quantities: $quantities

Type of Paper: $typeofpaper

Colour Paper: $colour

Ink Colour: $inkcolour

Sides: $sides

Finising: $finishing

Files Supplied: $filessupplied

EOD;
[/php]

Then take out the header that tells your email client that this is an HTML email
[php]
$headers = “From: $email\r\n”;
// $headers .= “Content-type: text/html\r\n”; REMOVE THIS LINE
$success = mail($webMaster, $emailSubject, $body, $headers);
[/php]

That should leave you with a plain text email message

Sponsor our Newsletter | Privacy Policy | Terms of Service