james13009 Posted March 13, 2008 Share Posted March 13, 2008 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 Quote Link to comment Share on other sites More sharing options...
AdRock Posted March 13, 2008 Share Posted March 13, 2008 dunno if this will help http://www.sitepoint.com/article/advanced-email-php Quote Link to comment Share on other sites More sharing options...
Blissey Posted March 13, 2008 Share Posted March 13, 2008 $header="from: $name <$mail_from>\r\n"; $header .= "Content-Type: text/html\r\n charset=iso-8859-1\r\n"; // Enter your email address $to ='someone@somewhere.com'; $send_contact=mail($to,$subject,$message,$header); Quote Link to comment Share on other sites More sharing options...
DarkPrince2005 Posted March 14, 2008 Share Posted March 14, 2008 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 Quote Link to comment Share on other sites More sharing options...
james13009 Posted March 14, 2008 Author Share Posted March 14, 2008 many thanks for the answers, all very helpfull. Last one worked a treat so a BIG thanks to DarkPrince2005 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.