Python Forum
Sending Emails in Portuguese
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Emails in Portuguese
#2
I stole the example from here: https://docs.python.org/3/library/email.examples.html
Looks like it will base64 encode the message if it needs to, so that it's just sending ascii. Hopefully this helps.

>>> import smtplib
>>> from email.message import EmailMessage
>>> msg = EmailMessage()
>>> msg.set_content("ç - testing - ç")
>>> msg["Subject"] = "email test"
>>> msg['From'] = "[email protected]"
>>> msg['To'] = "[email protected]"
>>> msg.as_string()
'Content-Type: text/plain; charset="utf-8"\nContent-Transfer-Encoding: base64\nMIME-Version: 1.0\nSubject: email test\nFrom: [email protected]\nTo: [email protected]\n\nw6cgLSB0ZXN0aW5nIC0gw6cK\n'
>>> s = smtplib.SMTP('localhost') #or wherever
>>> s.send_message(msg)
>>> s.quit()
Reply


Messages In This Thread
Sending Emails in Portuguese - by RenanPereira10 - Jul-23-2020, 06:33 PM
RE: Sending Emails in Portuguese - by nilamo - Jul-24-2020, 12:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using dictionary to find the most sent emails from a file siliusu 6 7,878 Apr-22-2021, 06:07 PM
Last Post: siliusu

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020