Jump to content

nesting html in a contact form email.


james13009

Recommended Posts

Im am still trying to master this, all i want to do is:

 

1: Person fills out an online form

2: Form gets emailed to me

--(which i can do)--

3: All i want now is for this form to included some html for example a picture, so i can just print it off.

 

I been told i need to echo it but am unsure on how to do this because the message is encapsulated the the varible $message. Im sure this is simple but im just having trouble please help.

 

Right my code: This is just the contact form i am using

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

 

 

 

 

And now for the script;

 

 

############### Code

<?php
// Contact subject
$subject ="$subject"; 
// Details
$message="$detail"; 

// Mail of sender
$mail_from="$customer_mail"; 
// From 
$header="from: $name <$mail_from>"; 

// Enter your email address
$to ='someone@somewhere.com'; 

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

 

Many thanks

James

Link to comment
Share on other sites

Ok dude, i can solve it for you, it took me a while to actually figure it out myself but attached is the code for the page that your contact page will email it's entries to, there are a few requirements though, which are to download PHPMailer, and to view the emailss you recieve correctly justt make sure that the program you use to manage your emails automatically downloads the images.

 

<?php

require("class.phpmailer.php");

$arremails='addy@host.com';

$mail = new PHPMailer();

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.server.com"; // SMTP server

$mail->From = "addy@host.com";
$mail->AddAddress($arremails); 

$mail->Subject = "Subject";
$mail->IsHTML(true);
$mail->Body = "<center><table width='400' border='0' cellspacing='0' cellpadding='0'>
  <tr> 
    <td><table width='100%' border='0' cellpadding='0' cellspacing='0'>
			<tr>
				<td> </td>
				<td>Your First Name:</td>
				<td> </td>
				<td>$_POST[First_Name]</td>
			</tr>
			<tr>
				<td> </td>
				<td>Your Last Name:</td>
				<td> </td>
				<td>$_POST[Last_Name]</td>
			</tr>
      </table></td>
  </tr>
</table>";

if(!$mail->Send()) {
  echo "<script language=JavaScript>window.location='mailfail.html'</script><br>";
} else {
  echo "<script language=JavaScript>window.location='thankyou.html'</script><br>";
};
?>

 

 

Let me now if it helps

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.