• Uncategorized

About html : Multiple-html-files-in-Email-body

Question Detail

i have multiple csv files:

I’m using this script to get html output:

#!/usr/bin/python

import pandas as pd
import sys
import json
sys.stdout = open('output.html','wt')

df = pd.read_csv('users.csv')
print(df.to_html())

For other file

#!/usr/bin/python

import pandas as pd
import sys
import json
sys.stdout = open('output1.html','wt')

df = pd.read_csv('groups.csv')
print(df.to_html())

created mailheader file

To: [email protected]
Subject: my subject
Content-Type: text/html

Then run:

cat mailheader output.html output1.html | sendmail -t

It attaches both files into email body, but i would like to add file name and space between tables, is it possible ?

    users.csv 

    output.html content

    groups.csv 

   output1.html

desired output:https://1drv.ms/w/s!AizscpxS0QM4hJo7PSSUarnfy8BEvg

Sorry for doc file, space between 2 tables doesn’t have to be so large, just couldn’t reduce it

Question Answer

to each file added

<br></br>
        <caption><b>Some Title</b></caption>
        <br></br>

and perpended each file

echo -e "<br></br>\n\t<caption><b>HTML E-mail</b></caption>\n\t<br></br>\n$(cat 1.html)" > output1.html

and send it:cat mailheader output.html output1.html output3 output4 | sendmail -t

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.