Attaching two tables adjacent to each other in Email Body using Pandas - html auto mail

Viewed 25

I have a doubt about Emailing Dataframe tables.

I have used the below code to generate the mail as shown in the image

  #Mail format and data frame to be included in the list
msg = MIMEMultipart()
msg['Subject'] = Subject
msg['From'] = sender
msg['To'] = ",".join(receiver)

html = """\
<html>
  <head> 
  </head>
  <h4> THE FOLLOWING ORDERS ARE PENDING IN OFFLINE </h4>
  <body>
  <p style="color:red"><strong>Based on Offline Number - Offline R only</strong>
    {0}
  <p style="color:magenta">
  <strong>Exception orders - Offline R- No Vendor Available</strong>
    {1}
  </p>
  <p style="color:BlueViolet">
  <strong>Exception orders - Offline H- No Vendor Available</strong>
    {2}
  </p>
  <br>
  Please refer to Excel File available in the following path to get line-wise details
  </p>
  <p style="color:SteelBlue">
  Regards,
  <br>
  <strong>Gold Sourcing - Planning</strong>
  </body>
</html>


""".format(df_pivot_qty.to_html(classes='table table-striped text-center', justify='center',border="2"),df_pivot_exce_qty_R.to_html(classes='table table-striped text-center', justify='center',border="2"),df_pivot_exce_qty_H.to_html(classes='table table-striped text-center', justify='center',border="2"))
           

p1 = MIMEText(html,'html')
msg.attach(p1)

enter image description here

How can I bring the tables adjacent to each other as indicated by the arrow

0 Answers
Related