email-headers

Problem sending utf-8 display name in Gmail API

Problem sending utf-8 display name in Gmail API Question: So I have a function which I use to send emails through Gmail API: def send_email(payload, messagesubject, sendtoaddresses, key_file_path: str, subject: str): messagedraft = MIMEText(payload, "plain") mailservice = build_mail_service(key_file_path, subject) messagedraft["From"] = f"Display name <{subject}>" messagedraft["Subject"] = messagesubject for address in sendtoaddresses.split(","): if "To" in messagedraft: …

Total answers: 1

Regex to catch email addresses in email header

Regex to catch email addresses in email header Question: I’m trying to parse a To email header with a regex. If there are no <> characters then I want the whole string otherwise I want what is inside the <> pair. import re re_destinatario = re.compile(r’^.*?<?(?P<to>.*)>?’) addresses = [ ‘XKYDF/ABC (Caixa Corporativa)’, ‘Fulano de Tal …

Total answers: 2

python imaplib to get gmail inbox subjects titles and sender name

python imaplib to get gmail inbox subjects titles and sender name Question: I’m using pythons imaplib to connect to my gmail account. I want to retrieve the top 15 messages (unread or read, it doesn’t matter) and display just the subjects and sender name (or address) but don’t know how to display the contents of …

Total answers: 6