-5
I’m having some difficulty with an attempt to send email via Win32.
When sending the email, at the end of the body, it always appears "ppppppppppppp"
[![exemplo_email_sent][1]][1]
I already sent in the beginning, some emails and never appeared these "p". Out of nowhere, they appeared and I see no error in the code. I think it should be the library folder or whatever?.
Follows the Code
import win32com.client as win32
# criar a integração com o outlook
outlook = win32.Dispatch('outlook.application')
# criar um email
email = outlook.CreateItem(0)
faturamento = 1500
qtde_produtos = 10
ticket_medio = faturamento / qtde_produtos
# configurar as informações do seu e-mail
email.To = "destino; destino2"
email.Subject = "E-mail automático do Python"
email.HTMLBody = f"""
<p>Olá Lira, aqui é o código Python</p>
<p>O faturamento da loja foi de R${faturamento}</p>
<p>Vendemos {qtde_produtos} produtos</p>
<p>O ticket Médio foi de R${ticket_medio}</p>
<p>Abs,</p>
<p>Código Python</p>
"""
email.Send()
print("Email Enviado")
Please clarify your problem or provide additional details in order to highlight exactly what you need. The way it’s written these days it’s hard to tell exactly what you’re asking.
–
Try adding the line
email.BodyFormat = 2
email settings. Reference: https://docs.microsoft.com/pt-br/office/vba/api/outlook.olbodyformat– Augusto Vasques