kootenpv / yagmail

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

can i use attached '*.rar'? #94

Open kxltsuper opened 7 years ago

kxltsuper commented 7 years ago

import yagmail subject = 'This is obviously the subject' body = 'This is obviously the body' html = 'Click me!' rarfile='/local/path/rarfile.rar' yag = yagmail.SMTP() yag.send(to = 'example@gmail.com', subject = subject, contents = [body, html ,rarfile]) print("already send email")

but the rarfile.rar is not recognized as a email attached file. It is just a plain text.

in the example@gmail.com , the result is this: 'This is obviously the body' Click me! /local/path/rarfile.rar.

no attached file.

when i use png, txt, it works well.

kootenpv commented 7 years ago

I think google won't let you send rar files; I get:

smtplib.SMTPDataError: (552, b'5.7.0 This message was blocked because its content presents a potential\n5.7.0 security issue. Please visit\n5.7.0 https://support.google.com/mail/?p=BlockedMessage to review our\n5.7.0 message content and attachment content guidelines. k27sm3121586eda.79 - gsmtp')

in your case, if it just sends it as text, that means the file does not exist.