Creating email with text and HTML does not work | Email spacing

Asked

Viewed 31 times

0

I’m having difficulty creating an email on pandas that will send a text and an HTML.

Dear,

Sending test;

Over the phones: XXXXXX - XXXXXXXXX

• TEST

Rejected (s):

HERE COMES AN HTML TABLE THAT EXITS CORRECTLY IN THE CODE

I tried the way below, but unsuccessfully in formatting.

    ## Função para envio do e-mail
    
    outlook = win32.Dispatch('outlook.application')
    mail = outlook.CreateItem(0)
    mail.To = emailpara
    mail.Subject = 'Message subject'
    mail.Body = 'MESAGEMMMMMMMMMMMMM'
   
    corpo = ("Prezados," + "\n Teste de envio;" + "\n \n \n Através dos telefones: XXXXXX - XXXXXXXXX" + "\n TESTE " + "\n Rejeitado (s): ")
    
                                        
    mail.HTMLBody = (corpo) + delcolunas.to_html(index = False).format(corpo)
        

    mail.Display()
else:
  • 1

    What did you mean by pandas?

1 answer

2

Replace the \n for <br>

Explanation: you opted for the mail.HTMLBody. If the body (body) email is HTML, you should use HTML tags.

I hope it helps

  • Thank you so much!!!!!!! I really got lost in this part and it makes perfect sense.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.