I have succesfully created a program that send multiple emails, but I'm not having success to format the text correctly.
Every time that I try to create a new line, python automatically inserts a new paragraph and I don't want that. I have tried to place .lstrip at the ent of the text block, after the """ but didn't work.
The text should be like this:
"Dear owner,
Our records indicate that your payment have not been received so far.
The total due is:"
But is being printed on the email like this:
"Dear owner
Our records indicate that your payment have not been received so far.
The total due is:"
Please see my code below, thanks for any inputs.
import email
import win32com.client as client
import pandas as pd
tabela = pd.read_excel('over60.xlsx')
#print(tabela)
data = tabela[['Customer','Email','Owner','Total Due']].values.tolist()
for dado in data:
owner_number = dado[0]
to = dado[1]
owner = dado[2]
amount = dado[3]
outlook = client.Dispatch('Outlook.Application')
account = outlook.session.Accounts['myemail.com']
email = outlook.CreateItem(0)
email.To = 'myemail.com'
email.Subject = f'Past Due Notice - {owner} - {owner_number}'
email.Body =f""" Dear {owner},
Our records indicate that your payment have not been received so far.
The total due is ${amount: .2f}.