OK...I was able to get this working....
But my question is how can I get a bit more effective with the html formatting...Maybe a vertical table? Any ideas on how to modify this to be a vertical table?
Im not sure how to target the specific fields to put in the html formatting. Thoughts?
DESIRED_COLUMNS = ('county','ramp','date','trailblazers','regulations','safteygsign','rutfree','potholes','grass','trash','portapotties','lighting',
'courtesypier','boatslide','fishingpier','debris','potholesramp','bulkhead','shoreline','contractor','comments','CreationDate','Creator','EditDate','Editor')
f2 = open("z_outFileRegion3.csv")
reader = csv.reader(f2)
headers2 = [1,2,3,4,8,12,16,20,24,28,32,36,41,45,49,53,57,61,65,69,74,75,76,77,78]
results2 = []
for row in reader:
if not headers2:
headers2 = []
for i, col in enumerate(row):
if col in DESIRED_COLUMNS:
# Store the index of the cols of interest
headers2.append(i)
else:
results2.append(tuple([row for i in headers2]))
#...SNIP
cols1 = ["<td>{0}</td>".format( "<td><td/>".join(t)) for t in results2]
rows1 = "<tr>{0}</tr>".format( "<tr><tr/><br>".join(cols1))
html1 = """<HTML>
<body>
<h4>Attendance list</h4>
<table>
{0}
</table>
</body>
</HTML>""".format(rows1)
part4 = MIMEText(html1, 'html')
msg.attach(part4)
#...SNIP