eyegraphix Posted March 2, 2006 Share Posted March 2, 2006 I'm e-mailing the contents of a form using the mail function. Some of the content e-mailed needs to be organized like in a table so that it looks nice when opened up. I tried doing this, but in the e-mail all I see is the html code. I know this must be easy, but, help? Quote Link to comment Share on other sites More sharing options...
TronB24 Posted March 2, 2006 Share Posted March 2, 2006 Can you post the code? Quote Link to comment Share on other sites More sharing options...
eyegraphix Posted March 2, 2006 Author Share Posted March 2, 2006 Here's the mail content, what is sent off to the user. [code]$mailContent="Name:".$fname." ".$lname." "."sent the following preapplication materials \n\n" ."Name: ".$fname." ".$lname.": I am ".$gender."\n" ."Address: ".$address."\n" ."Telephone: ".$telephone."\n" ."E-mail: ".$email."\n" ."Country of Citizenship: ".$country."\n" ."Degree sought ".$degreesought."\n\n" ."College of University \n" ."Name and Location \n" .$c1."\n" ."Dates attended \n" .$c1dts."\n" ."Major \n" .$clmj."\n" ."Degree \n" .$cldgre."\n" ."Deg. Date \n" .$clddt."\n" ."GPA \n" .$clgpa."\n\n" ."College of University 2 \n" ."Name and Location \n" .$c2."\n" ."Dates attended \n" .$c2dts."\n" ."Major \n" .$c2mj."\n" ."Degree \n" .$c2dgre."\n" ."Deg. Date \n" .$c2ddt."\n" ."GPA \n" .$c2gpa."\n\n" ."College of University 3 \n" ."Name and Location \n" .$c3."\n" ."Dates attended \n" .$c3dts."\n" ."Major \n" .$c3mj."\n" ."Degree \n" .$c3dgre."\n" ."Deg. Date \n" .$c3ddt."\n" ."GPA \n" .$c3gpa."\n\n" ."<html><table width='100%' border='0'> <tr> <td>Course Type </td> <td>Sem. 1 </td> <td>Sem. 2 </td> </tr> <tr> <td>General Chemistry </td> <td>".$gchem1."</td> <td>".$gchem2."</td> </tr> <tr> <td>Physical Chemistry </td> <td>".$pchem1."</td> <td>".$pchem2."</td> </tr> <tr> <td>Analytical Chemistry </td> <td>".$achem1."</td> <td>".$achem2."</td> </tr> <tr> <td>Biochemistry</td> <td>".$bchem1."</td> <td>".$bchem1."</td> </tr> <tr> <td>Organic Chemistry </td> <td>".$gchem1."</td> <td>".$gchem1."</td> </tr> <tr> <td>Physics</td> <td>".$phy1."</td> <td>".$phy2."</td> </tr> <tr> <td>Calculus</td> <td>".$calc1."</td> <td>".$calc2."</td> </tr> <tr> <td>Other Science </td> <td rowspan='2'>".$oscia1."</td> <td rowspan='2'>".$oscia2."</td> </tr> <tr> <td>".$oscia."</td> </tr> <tr> <td>Other Science </td> <td rowspan='2'>".$oscib1."</td> <td rowspan='2'>".$oscib2."</td> </tr> <tr> <td>".oscib."</td> </tr></table></body></html>"."\n"; [/code] Quote Link to comment Share on other sites More sharing options...
willpower Posted March 2, 2006 Share Posted March 2, 2006 see the recent posting on embedding images in mail....i have just posted the solution in there.Will Quote Link to comment Share on other sites More sharing options...
eyegraphix Posted March 3, 2006 Author Share Posted March 3, 2006 Hey willpower, great code but the problem is that only part of $mailContent needs to be formatted in html. I suppose I could rewrite the whole $mailContent variable to be in html, but I really don't want to do that unless I have to. What I tried, was put all the content that needs to be html formatted in a variable called $html , then I just conctated that to the $mailContent variable. All the information is sent when e-mailed, but the content that's not html is not formatted right. Hope this makes sense. The relevant code is below.[code]$html=<<<HTML_OUTPUT<html><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /><title>Untitled Document</title></head><body><table width='100%' border='0'> <tr> <td>General Chemistry </td> <td>".$gchem1."</td> <td>".$gchem2."</td> </tr> <tr> <td>Physical Chemistry </td> <td>".$pchem1."</td> <td>".$pchem1."</td> </tr> <tr> <td>Analytical Chemistry</td> <td>".$achem1."</td> <td>".$achem1."</td> </tr> <tr> <td>Biochemistry</td> <td>".$bchem1."</td> <td>".$bchem1."</td> </tr> <tr> <td>Organic Chemistry</td> <td>".$ochem1."</td> <td>".$ochem1."</td> </tr> <tr> <td>Physics</td> <td>".$phy1."</td> <td>".$phy2."</td> </tr> <tr> <td>Calculus</td> <td>".$calc1."</td> <td>".$calc2."</td> </tr> <tr> <td>Other Science </td> <td rowspan="2">".$oscia1."</td> <td rowspan="2">".$oscia2."</td> </tr> <tr> <td>".$oscia."</td> </tr> <tr> <td>Other Science </td> <td rowspan='2'>".$oscib1."</td> <td rowspan='2'>".$oscib2."</td> </tr> <tr> <td>".$oscib."</td> </tr></table></body></html>HTML_OUTPUT;$mailContent="Name:".$fname." ".$lname." "."sent the following preapplication materials \n\n" ."Name: ".$fname." ".$lname.": I am ".$gender."\n" ."Address: ".$address."\n" ."Telephone: ".$telephone."\n" ."E-mail: ".$email."\n" ."Country of Citizenship: ".$country."\n" ."Degree sought: ".$dgresot."\n\n" ."College of University \n" ."Name and Location: \n" .$c1."\n" ."Dates attended: \n" .$c1dts."\n" ."Major: \n" .$c1mj."\n" ."Degree: \n" .$c1dgre."\n" ."Deg. Date: \n" .$c1ddt."\n" ."GPA: \n" .$c1gpa."\n\n" ."College of University 2 \n" ."Name and Location: \n" .$c2."\n" ."Dates attended: \n" .$c2dts."\n" ."Major: \n" .$c2mj."\n" ."Degree: \n" .$c2dgre."\n" ."Deg. Date: \n" .$c2ddt."\n" ."GPA: \n" .$c2gpa."\n\n" ."College of University 3 \n" ."Name and Location: \n" .$c3."\n" ."Dates attended \n" .$c3dts."\n" ."Major: \n" .$c3mj."\n" ."Degree: \n" .$c3dgre."\n" ."Deg. Date: \n" .$c3ddt."\n" ."GPA: \n" .$c3gpa."\n". $html."GRE Scores \n"."Verbal ".$grev." ".$grevper."\n"."Quant. ".$grq." ".$greqper."\n"."Analy. ".$grea." ".$greaper."\n"."Total ".$total."\n"."Subject GRE: Subject: ".$gresub." Score: ".$gresubscore." ".$gresubper."\n"."TOEFL Score: ".$toefl."\n"."Areas of Research interest: ".$interest."\n"."Publications: ".$pubs."\n"."Additional Information: ".$addinfo."\n"."Server protocol: ".$remotehost."\n"."Remote IP address: ".$ip."\n";//End of $mailcontent$headers = "From: xxx \r\n";$headers .="Reply-to: xxx \r\n";$headers .="MIME-Version: 1.0\r\n";$boundary = uniqid ("something");$headers .="Content-Type: multipart/alternative" . "; boundary = $boundary\r\n\r\n";$headers .="This is a MIME encoded message. \r\n\r\n";$headers .="--$boundary\r\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" ."Content-Transfer-Encoding: base64\r\n\r\n";$headers .= chunk_split(base64_encode("$textversion"));$headers .="--$boundary\r\n" . "Content-Type: text/html; charset=ISO-8859-1\r\n" . "Content-Transfer-Encoding: base64\r\n\r\n";$headers .= chunk_split(base64_encode("$mailContent"));$email2="asiegrist@gmail.com";$subject="Preapplication (Forms submission)";if (!$lname) { echo "<b>Thank you</b> <br> You have not provided your last/familyname. All requested information must be submitted or we will not be able to properly process your preapplication"; }else { mail($email2, $subject, $mailContent, $headers); echo "Thank you for submitting a preapplication. Our graduate committee will review the materials and advise you oftheir decision."; }[/code] Quote Link to comment Share on other sites More sharing options...
helpmeplease2 Posted March 3, 2006 Share Posted March 3, 2006 I can't get this to work. I'm using:[code]<?php $bar = <<<HTML_OUTPUT<img src="http://www.site.com/images/picture.gif">HTML_OUTPUT;?><a href="javascript:addmsgtxt('Greetings,\n\n<?php $bar ?>')">Greetings</a><br>[/code]I'm using javascript to insert the image into the <textarea> field, but its not including the code when it sends. What am I doing wrong? If I just type in the code into the textarea field and send it, it only displays the code in the email and not the picture I'm trying to insert.I've tried sending html using my custom mailing list for the longest time, and everything I try fails. 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.