kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

How can I send email in plain text? #166

Closed aktywnitu closed 4 years ago

aktywnitu commented 4 years ago

Hi,

I am trying to send email with plain text, but I always receive email with
tags. yag.send(data['email'], data['subject'], data['contents'])

ajgringo619 commented 4 years ago

If this is not a feature, please add it if possible!!! I created a gmail account exclusively for sending updates from my PC to my phone and personal email, and the formatting looks horrible in HTML.

ajgringo619 commented 4 years ago

I've found that my test emails are being sent as html/text; at least I can use my email program (Evolution) to select the format I want to see. The docs here mention a raw setting for forcing emails in text only, but I can't get it to work.

kootenpv commented 4 years ago

Does the following not work?

import yagmail
yag = yagmail.SMTP("username", "password")
yag.send(contents=yagmail.raw("hi"))
ajgringo619 commented 4 years ago

It does, but it's coming in as both html and text. I was hoping to send text-only emails, mainly to my phone (as SMS), but also to my PC.

kootenpv commented 4 years ago

I guess for simple emails you can then simply use smtplib.

ajgringo619 commented 4 years ago

OK, no big deal. Using the .raw method works great on my phone; the only anomaly is that the last 2 characters get cut off the body of the message (seriously doubt that's on your end). Thanks for your help!

kootenpv commented 4 years ago

Thanks