I am sending a .txt file from a cfmail tag. I can display the correct formatting on the screen; but I have not been able to successfully format the actual attachment. If I use <table> and <tr><td> tags, they appear on the actual .txt attachment.
Here is my code:
<form action="mail.cfm" method="post" enctype="multipart/form-data" name="mail" id="mail">
<cfset TodaysDate = #DateFormat(Now(),"mm/dd/yy")#>
<cfset csvmethod = "True">
<cfsavecontent variable="content">
<cfoutput>#header# #todaysdate# #Chr(13)#</cfoutput>
<cfoutput query="mailqry">
<table>
<tr>
<td>#field1##Chr(9)#</td>
<td>#field2##Chr(9)# </td>
<td>#field2##Chr(9)#</td>
<td>#field4##Chr(9)#</td>
</tr>
</table>
</cfoutput>
</cfsavecontent>
</form>
<cfset outputpath = "#RootPath#\mail\folder">
<cffile action = "write" file = "#outputpath#\myfile.txt" output = "#content#">
<CFSET subjectline = "The information you requested">
<CFSET email = "rosn@hotmail.com">
<CFSET fromemail = "admin@mt.com">
<CFSET file1="#outputpath#\myfile.txt">
<cfmail to="#email#" from="#fromemail#" subject="#subjectline#" type="HTML">
Please find attached the information you requested. File is current as of #TodaysDate#.
<cfif FileExists(file1)>
<cfcontent type="text/html" file="#file1#" deletefile="No">
<cfmailparam file = "#file1#">
</cfif></cfmail>
Here is what appears on the .txt atatchment:
<table><tr><td>Field1info</td>
<td>Field2info</td>
<td>Field3info</td>
<td>Field4info</td></tr></table>
How do I format the attachment so the fields are aligned in the proper columns without the html formatting being visible?
Here is my code:
<form action="mail.cfm" method="post" enctype="multipart/form-data" name="mail" id="mail">
<cfset TodaysDate = #DateFormat(Now(),"mm/dd/yy")#>
<cfset csvmethod = "True">
<cfsavecontent variable="content">
<cfoutput>#header# #todaysdate# #Chr(13)#</cfoutput>
<cfoutput query="mailqry">
<table>
<tr>
<td>#field1##Chr(9)#</td>
<td>#field2##Chr(9)# </td>
<td>#field2##Chr(9)#</td>
<td>#field4##Chr(9)#</td>
</tr>
</table>
</cfoutput>
</cfsavecontent>
</form>
<cfset outputpath = "#RootPath#\mail\folder">
<cffile action = "write" file = "#outputpath#\myfile.txt" output = "#content#">
<CFSET subjectline = "The information you requested">
<CFSET email = "rosn@hotmail.com">
<CFSET fromemail = "admin@mt.com">
<CFSET file1="#outputpath#\myfile.txt">
<cfmail to="#email#" from="#fromemail#" subject="#subjectline#" type="HTML">
Please find attached the information you requested. File is current as of #TodaysDate#.
<cfif FileExists(file1)>
<cfcontent type="text/html" file="#file1#" deletefile="No">
<cfmailparam file = "#file1#">
</cfif></cfmail>
Here is what appears on the .txt atatchment:
<table><tr><td>Field1info</td>
<td>Field2info</td>
<td>Field3info</td>
<td>Field4info</td></tr></table>
How do I format the attachment so the fields are aligned in the proper columns without the html formatting being visible?