# Solved: Formatting ASP mail with HTML?



## smooth (Sep 26, 2005)

Hey everybody 

I have a form on a page, that when submitted goes to an ASP page I have, that emails out the contents. It is as follows:


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "IFG Agents - Weekly Annuity Production Report"
Mail.BodyText   = "Here is the Weekly Annuity Production Report for " & Request.Form("agent") & vbcrlf & vbcrlf	& "Agent Name:  " & Request.Form("agent") & vbcrlf & "Agency/Team: " & Request.Form("agencyTeam") & vbcrlf & "Mentor:      " & Request.Form("mentor") & vbcrlf & "Week Ending: " & Request.Form("weekEnding") & vbcrlf & vbcrlf & "Company" & "           # of Apps" & "       Monthly Premium" & "     Annual Premium" & vbcrlf & "Allianz" & "              " & Request.Form("allianzApps")  & "              " & Request.Form("allianzMonthlyPremium")	& "               " & Request.Form("allianzAnnualPremium") & vbcrlf	& "Americo" & "              " & Request.Form("americoApps")  & "              " & Request.Form("americoMonthlyPremium") & "               " & Request.Form("americoAnnualPremium") & vbcrlf & "Equity Trust" & "     " & Request.Form("equityApps")  & "           " & Request.Form("equityMonthlyPremium") & "            " & Request.Form("equityAnnualPremium") & vbcrlf & "F & G" & "                " & Request.Form("fgApps")  & "              " & Request.Form("fgMonthlyPremium") & "               " & Request.Form("fgAnnualPremium") & vbcrlf	& "ING" & "                  " & Request.Form("ingApps")  & "              " & Request.Form("ingMonthlyPremium")	& "               " & Request.Form("ingAnnualPremium") & vbcrlf & "North American" & "        " & Request.Form("northAmericanApps")  & "              " & Request.Form("northAmericanMonthlyPremium") & "               " & Request.Form("northAmericanAnnualPremium") & vbcrlf & "Presidential" & "      " & Request.Form("presidentialApps")  & "            " & Request.Form("presidentialMonthlyPremium") & "             " & Request.Form("presidentialAnnualPremium") & vbcrlf & vbcrlf & "Totals              " & Request.Form("appsTotal") & "             " & Request.Form("monthlyPremiumTotal") & "              " & Request.Form("annualPremiumTotal") & vbcrlf
				
if Mail.SendMail then
 Response.redirect "../production_report_thanks.asp"
else
 Response.Write "Mail send failure. Error was " & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```
Now, that works great, except it is in plain text, and not very attractive/easy to read.

I want to be able to email this information in an HTML table. I was wondering how I could go about doing this? I've tried a couple of things, but can't get it to going quite right. I basically want a nice looking table, with some colored cells and text to be emailed out.

Any suggestions are greatly appreciated.


----------



## covert215 (Apr 22, 2006)

Append html tags to the BodyText...it should be parsed if you add the tags into the string


----------



## smooth (Sep 26, 2005)

covert215 said:


> Append html tags to the BodyText...it should be parsed if you add the tags into the string


Not sure if I understand what you mean. Do you mean just add 
Text here
 to it like that?

What about if I want to have styles in it as well. Seems like when I tried this, I kept getting an error about expecting an end of a statement, due to the multiple parentheses.


----------



## covert215 (Apr 22, 2006)

that is correct

use [TD] to change colors...don't use styles


----------



## smooth (Sep 26, 2005)

I'm still getting an error. It says there is a unterminated string. Do I have to put a " before and after each line in the code? Also, do I need to put a & in between them as well?


----------



## covert215 (Apr 22, 2006)

quotations within the html need to be prefixed with \


----------



## smooth (Sep 26, 2005)

Here is what I have so far:


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = "<html>
                    <body>
				       <table cellpadding="5" cellspacing="0" width="100%">
				         <tr>
                           <td colspan="4"><div align="left">Agent Information</div></td>
                         </tr>
                         <tr>
                           <td width="25%"><div align="left">"Name"</div></td>
                           <td width="25%"><div align="left">Team</div></td>
                           <td width="25%"><div align="left">Mentor</div></td>
                           <td width="25%"><div align="left">Week Ending</div></td>
                         </tr>
                         <tr>
                           <td><div align="left">Annuity</div></td>
                           <td><div align="center">Total of <br />Num of Apps</div></td>
                           <td><div align="center">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align="center">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Allianz</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Americo</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Equity Trust</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">F &amp; G</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">ING</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Presidential</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Annuity Totals</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td colspan="4">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align="left">Disability</div></td>
                          <td><div align="center">Total of <br />Num of Apps</div></td>
                          <td><div align="center">Total of Disability Monthly Premiums</div></td>
                          <td><div align="center">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Illinois Mutual</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Life Investors</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Disability Totals</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td colspan="4">&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align="left">Life</div></td>
                          <td><div align="center">Total of <br />Num of Apps</div></td>
                          <td><div align="center">Total of Life <br />Monthly Premiums</div></td>
                          <td><div align="center">Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align="left">Americo</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Chesapeake</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">F &amp; G</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
                        <tr>
                          <td><div align="left">Life Investors</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Presidential</div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                          <td><div align="center"></div></td>
                        </tr>
                        <tr>
                          <td><div align="left">Shenandoah</div></td>
                          <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">United of Omaha</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">Life Totals</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td colspan="4">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align="left">Long-Term Care</div></td>
						  <td><div align="center">Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align="center">Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align="center">Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align="left">Mutual of Omaha</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">LT Care Totals</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
					    </tr>
						<tr>
						  <td colspan="4">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align="left">Medicare Supplemental</div></td>
						  <td><div align="center">Total of <br />Num of Apps</div></td>
						  <td><div align="center">Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align="center">Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align="left">Mutual of Omaha</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">Shenandoah</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">United World</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
						  <td><div align="left">Med. Supp. Totals</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
						<tr>
   						  <td colspan="4">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align="left">Overall Totals</div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						  <td><div align="center"></div></td>
						</tr>
				     </table>
                 </body>
               </html>"
if Mail.SendMail then
 Response.redirect "../production_report_thanks.asp"
else
 Response.Write "Mail send failure. Error was " & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```
When I try to run the form, it says I have a syntax error.


----------



## covert215 (Apr 22, 2006)

Change it to:


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = "<html>
                    <body>
				       <table cellpadding=\"5\" cellspacing=\"0\" width=\"100%\">
				         <tr>
                           <td colspan=\"4\"><div align=\"left\">Agent Information</div></td>
                         </tr>
                         <tr>
                           <td width=\"25%\"><div align=\"left\">Name</div></td>
                           <td width=\"25%\"><div align=\"left\">Team</div></td>
                           <td width=\"25%\"><div align=\"left\">Mentor</div></td>
                           <td width=\"25%\"><div align=\"left\">Week Ending</div></td>
                         </tr>
                         <tr>
                           <td><div align=\"left\">Annuity</div></td>
                           <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Allianz</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Equity Trust</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">ING</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Annuity Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Disability</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Disability Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Illinois Mutual</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Life Investors</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Disability Totals</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td colspan=\4\>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Life</div></td>
                          <td><div align=\center\>Total of <br />Num of Apps</div></td>
                          <td><div align=\center\>Total of Life <br />Monthly Premiums</div></td>
                          <td><div align=\center\>Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align=\left\>Americo</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Chesapeake</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>F &amp; G</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
                        <tr>
                          <td><div align=\left\>Life Investors</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Presidential</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Shenandoah</div></td>
                          <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>United of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Life Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Long-Term Care</div></td>
						  <td><div align=\center\>Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align=\center\>Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align=\center\>Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Mutual of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>LT Care Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
					    </tr>
						<tr>
						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Medicare Supplemental</div></td>
						  <td><div align=\center\>Total of <br />Num of Apps</div></td>
						  <td><div align=\center\>Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align=\center\>Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Mutual of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Shenandoah</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>United World</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Med. Supp. Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
   						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Overall Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
				     </table>
                 </body>
               </html>\
if Mail.SendMail then
 Response.redirect \../production_report_thanks.asp\
else
 Response.Write \Mail send failure. Error was \ & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```


----------



## brendandonhu (Jul 8, 2002)

You need to set Mailer.ContentType = "text/html"


----------



## covert215 (Apr 22, 2006)

I don't know ASP, I just recommended the use of escape characters to fix the unterminated string error.


----------



## brendandonhu (Jul 8, 2002)

Maybe its not a good idea to give people ASP code if you don't know ASP...


----------



## brendandonhu (Jul 8, 2002)

You've also escaped a bunch of backslashes that shouldn't be escaped.


----------



## covert215 (Apr 22, 2006)

brendandonhu said:


> You've also escaped a bunch of backslashes that shouldn't be escaped.


where?


----------



## smooth (Sep 26, 2005)

Thanks for the replies everyone. 

Here is what I have so far, says syntax error. I added the Mail.ContentType, like you said brendandonhu. I'm not sure if that is the correct way to implement it though.


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.ContentType = "text/html"
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = "<html>
                    <body>
				       <table cellpadding=\"5\" cellspacing=\"0\" width=\"100%\">
				         <tr>
                           <td colspan=\"4\"><div align=\"left\">Agent Information</div></td>
                         </tr>
                         <tr>
                           <td width=\"25%\"><div align=\"left\">Name</div></td>
                           <td width=\"25%\"><div align=\"left\">Team</div></td>
                           <td width=\"25%\"><div align=\"left\">Mentor</div></td>
                           <td width=\"25%\"><div align=\"left\">Week Ending</div></td>
                         </tr>
                         <tr>
                           <td><div align=\"left\">Annuity</div></td>
                           <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Allianz</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Equity Trust</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">ING</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Annuity Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Disability</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Disability Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Illinois Mutual</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Life Investors</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Disability Totals</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td colspan=\4\>&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Life</div></td>
                          <td><div align=\center\>Total of <br />Num of Apps</div></td>
                          <td><div align=\center\>Total of Life <br />Monthly Premiums</div></td>
                          <td><div align=\center\>Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align=\left\>Americo</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Chesapeake</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>F &amp; G</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
                        <tr>
                          <td><div align=\left\>Life Investors</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Presidential</div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                          <td><div align=\center\></div></td>
                        </tr>
                        <tr>
                          <td><div align=\left\>Shenandoah</div></td>
                          <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>United of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Life Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Long-Term Care</div></td>
						  <td><div align=\center\>Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align=\center\>Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align=\center\>Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Mutual of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>LT Care Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
					    </tr>
						<tr>
						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Medicare Supplemental</div></td>
						  <td><div align=\center\>Total of <br />Num of Apps</div></td>
						  <td><div align=\center\>Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align=\center\>Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Mutual of Omaha</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Shenandoah</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>United World</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
						  <td><div align=\left\>Med. Supp. Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
						<tr>
   						  <td colspan=\4\>&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\left\>Overall Totals</div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						  <td><div align=\center\></div></td>
						</tr>
				     </table>
                 </body>
               </html>\"
if Mail.SendMail then
 Response.redirect \../production_report_thanks.asp\
else
 Response.Write \Mail send failure. Error was \ & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```


----------



## Rockn (Jul 29, 2001)

If it sends an email in the format you want it is correct. Tat should be the way it is added if the component documentation states that is how you use it.


----------



## brendandonhu (Jul 8, 2002)

That code is correct, you just need to escape the quotes properly. All the double-quotes inside the text of your message need a \ before them but the quotes at the beginning and end of each string need to be removed.


----------



## brendandonhu (Jul 8, 2002)

covert215 said:


> where?


Like here:


> \


----------



## covert215 (Apr 22, 2006)

ooooooooooh....i did a find/replace...didn't pay attention to that


----------



## brendandonhu (Jul 8, 2002)

Also you should be using "" to replace each ", I don't think the backslash escape will work here.


----------



## covert215 (Apr 22, 2006)

oh..i'm used to java and php


----------



## smooth (Sep 26, 2005)

Hey guys, I really appreciate all the help. 

I'm still having some trouble with the code though. I've tried a couple of ways, just to make sure I am catching what you are saying correctly. The first way is this way:

```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.ContentType = "text/html"
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = <html>
                    <body>
				       <table cellpadding=\"5" cellspacing=\"0\" width=\"100%\"> 
				         <tr> 
                           <td colspan=\"4\"><div align=\"left\">Agent Information</div></td> 
                         </tr> 
                         <tr> 
						   <td width=\"25%\"><div align=\"left\">Name</div></td> 
                           <td width=\"25%\"><div align=\"left\">Team</div></td> 
                           <td width=\"25%\"><div align=\"left\">Mentor</div></td> 
                           <td width=\"25%\"><div align=\"left\">Week Ending</div></td> 
                         </tr> 
                         <tr>
                           <td><div align=\"left\">Annuity</div></td>
                           <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Allianz</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Equity Trust</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">ING</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Annuity Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Disability</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Disability Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Illinois Mutual</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Life Investors</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Disability Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Life</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Life <br />Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Chesapeake</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Life Investors</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Shenandoah</div></td>
                          <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">United of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Life Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Long-Term Care</div></td>
						  <td><div align=\"center\">Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align=\"center\">Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align=\"center\">Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Mutual of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">LT Care Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
					    </tr>
						<tr>
						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Medicare Supplemental</div></td>
						  <td><div align=\"center\">Total of <br />Num of Apps</div></td>
						  <td><div align=\"center\">Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align=\"center\">Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Mutual of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Shenandoah</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">United World</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Med. Supp. Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
   						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Overall Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
				     </table>
                 </body>
               </html>
if Mail.SendMail then
 Response.redirect ../production_report_thanks.asp
else
 Response.Write Mail send failure. Error was & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```
And I get this error:


```
Microsoft VBScript compilation  error '800a03ea'

Syntax error

/agents_revised/information/asp/emailProduction.asp, line 17

Mail.BodyText   = <html>
------------------^
```
The second way is this way:


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.ContentType = "text/html"
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = "<html>
                    <body>
				       <table cellpadding=\"5" cellspacing=\"0\" width=\"100%\"> 
				         <tr> 
                           <td colspan=\"4\"><div align=\"left\">Agent Information</div></td> 
                         </tr> 
                         <tr> 
						   <td width=\"25%\"><div align=\"left\">Name</div></td> 
                           <td width=\"25%\"><div align=\"left\">Team</div></td> 
                           <td width=\"25%\"><div align=\"left\">Mentor</div></td> 
                           <td width=\"25%\"><div align=\"left\">Week Ending</div></td> 
                         </tr> 
                         <tr>
                           <td><div align=\"left\">Annuity</div></td>
                           <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align=\"center\">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Allianz</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Equity Trust</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">ING</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Annuity Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Disability</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Disability Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Illinois Mutual</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Life Investors</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Disability Totals</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td colspan=\"4\">&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Life</div></td>
                          <td><div align=\"center\">Total of <br />Num of Apps</div></td>
                          <td><div align=\"center\">Total of Life <br />Monthly Premiums</div></td>
                          <td><div align=\"center\">Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align=\"left\">Americo</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Chesapeake</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">F &amp; G</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
                        <tr>
                          <td><div align=\"left\">Life Investors</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Presidential</div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                          <td><div align=\"center\"></div></td>
                        </tr>
                        <tr>
                          <td><div align=\"left\">Shenandoah</div></td>
                          <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">United of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Life Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Long-Term Care</div></td>
						  <td><div align=\"center\">Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align=\"center\">Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align=\"center\">Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Mutual of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">LT Care Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
					    </tr>
						<tr>
						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Medicare Supplemental</div></td>
						  <td><div align=\"center\">Total of <br />Num of Apps</div></td>
						  <td><div align=\"center\">Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align=\"center\">Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Mutual of Omaha</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Shenandoah</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">United World</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
						  <td><div align=\"left\">Med. Supp. Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
						<tr>
   						  <td colspan=\"4\">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=\"left\">Overall Totals</div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						  <td><div align=\"center\"></div></td>
						</tr>
				     </table>
                 </body>
               </html>"
if Mail.SendMail then
 Response.redirect ../production_report_thanks.asp
else
 Response.Write Mail send failure. Error was & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```
And I get this error:


```
Microsoft VBScript compilation  error '800a0409'

Unterminated string constant

/agents_revised/information/asp/emailProduction.asp, line 17

Mail.BodyText   = "<html>
-------------------------^
```
I'm guessing in the first one, the error is because there are two tags in the code. So I went to the putting the quotes before and after the table HTML. I'm not sure which way to go about it now, since I am still getting errors.


----------



## Rockn (Jul 29, 2001)

Why are you putting all of the backslashes in your HTML? For example your align attribute is surrounded with \ and that is not properly formatted HTML.

[TD]Allianz[/TD]


----------



## smooth (Sep 26, 2005)

Hey Rockn 

I am going by the suggestion given earlier, about escaping the quotes within the HTML, for the ASP page.


----------



## brendandonhu (Jul 8, 2002)

There are no backslashes needed here, you should use two sets of quotes instead like: ""


----------



## covert215 (Apr 22, 2006)

sorry for the bad advice...i'm not used to asp syntax


----------



## smooth (Sep 26, 2005)

No prob covert.  I know you were just trying to help 

Here is the code I have now:


```
<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head> 
<body> 

<% 
Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
TextMode = Multiline
Mail.ContentType = "text/html"
Mail.FromName   = Request.Form("agent")
Mail.FromAddress= "[email protected]"
Mail.RemoteHost = "mrelay.perfora.net" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "IFG Production", "[email protected]"
Mail.Subject    = "Testing Email Format"
Mail.BodyText   = "<html>
                    <body>
				       <table cellpadding=""5"" cellspacing=""0"" width=""100%""> 
				         <tr> 
                           <td colspan=""4""><div align=""left"">Agent Information</div></td> 
                         </tr> 
                         <tr> 
						   <td width=""25%""><div align=""left"">Name</div></td> 
                           <td width=""25%""><div align=""left"">Team</div></td> 
                           <td width=""25%""><div align=""left"">Mentor</div></td> 
                           <td width=""25%""><div align=""left"">Week Ending</div></td> 
                         </tr> 
                         <tr>
                           <td><div align=""left"">Annuity</div></td>
                           <td><div align=""center"">Total of <br />Num of Apps</div></td>
                           <td><div align=""center"">Total of Annuity <br />Monthly Premiums</div></td>
                           <td><div align=""center"">Total of Annuity <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Allianz</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Americo</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Equity Trust</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">F &amp; G</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">ING</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Presidential</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Annuity Totals</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td colspan=""4"">&nbsp;</td>
						</tr>
                        <tr>
                          <td><div align=""left"">Disability</div></td>
                          <td><div align=""center"">Total of <br />Num of Apps</div></td>
                          <td><div align=""center"">Total of Disability Monthly Premiums</div></td>
                          <td><div align=""center"">Total of Disability <br />Annual Premiums</div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Illinois Mutual</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Life Investors</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Disability Totals</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td colspan=""4"">&nbsp;</td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Life</div></td>
                          <td><div align=""center"">Total of <br />Num of Apps</div></td>
                          <td><div align=""center"">Total of Life <br />Monthly Premiums</div></td>
                          <td><div align=""center"">Total of Life<br />Annual Premiums</div></td>
                        </tr>
						<tr>
                          <td><div align=""left"">Americo</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Chesapeake</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">F &amp; G</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
                        <tr>
                          <td><div align=""left"">Life Investors</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Presidential</div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                          <td><div align=""center""></div></td>
                        </tr>
                        <tr>
                          <td><div align=""left"">Shenandoah</div></td>
                          <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">United of Omaha</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">Life Totals</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td colspan=""4"">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=""left"">Long-Term Care</div></td>
						  <td><div align=""center"">Total  Num<br />of LT Care  Apps</div></td>
						  <td><div align=""center"">Total of LT Care <br />Monthly Premiums</div></td>
						  <td><div align=""center"">Total of LT Care <br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=""left"">Mutual of Omaha</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">LT Care Totals</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
					    </tr>
						<tr>
						  <td colspan=""4"">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=""left"">Medicare Supplemental</div></td>
						  <td><div align=""center"">Total of <br />Num of Apps</div></td>
						  <td><div align=""center"">Total of Med. Supp. Monthly Premiums</div></td>
						  <td><div align=""center"">Total of Med. Supp.<br />Annual Premiums</div></td>
						</tr>
						<tr>
						  <td><div align=""left"">Mutual of Omaha</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">Shenandoah</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">United World</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
						  <td><div align=""left"">Med. Supp. Totals</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
						<tr>
   						  <td colspan=""4"">&nbsp;</td>
						</tr>
						<tr>
						  <td><div align=""left"">Overall Totals</div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						  <td><div align=""center""></div></td>
						</tr>
				     </table>
                 </body>
               </html>"
if Mail.SendMail then
 Response.redirect ../production_report_thanks.asp
else
 Response.Write Mail send failure. Error was & Mail.Response
end if 
%> 

<body> 
<p>Thank You!!<br>
</body>
</html>
```
But I still get this error:

```
Microsoft VBScript compilation  error '800a0409'

Unterminated string constant

/agents_revised/information/asp/emailProduction.asp, line 18

Mail.BodyText   = "<html>
-------------------------^
```
I've tried it without the quotes before and after . I've also tried it with double quotes before and after


----------



## covert215 (Apr 22, 2006)

add line concatenations between each line so that they whole thing is recognized as 1 huge string...the & operator is used (I looked this up) to combine the strings. Currently, your code is interpreted only as

Mail.BodyText = "

That quote doesn't end on the same line so it is an unclosed string.


----------



## brendandonhu (Jul 8, 2002)

That looks better....Mail.BodyText needs to all be on one line like it was in your first post and you can use 
to make the line breaks instead of vbCrLf


----------



## smooth (Sep 26, 2005)

Awesome, I finally have it working right, where I can email the table. :up: Thanks so much everyone 

Still trying to figure out how I can use something for setting background colors for certain rows, without actually hand coding it. But if I need to, I can just do that as well. 

I'm gonna leave this thread unsolved for now, since I now have to add in the data from the form. I think I have an idea of how to do it, since I've done it plain text style. I'll keep you posted on how it works.


----------



## covert215 (Apr 22, 2006)

in the [TR] tag that you want colored, change it to [TR]

replace the word hexadecimal with the 6 character hexadecimal code for the color

you can find the codes here- http://www.geocities.com/webtvbeth/hexchart.html


----------



## smooth (Sep 26, 2005)

Thanks for all the help everyone.  

The form is now mailing out everything correctly. :up: I really appreciate all the help


----------

