Check the email message size limit with Python
Can someone tell me, how could I check the size limit of an email message. So, if all attachements together exceeded the limit, I cou开发者_高级运维ld send them in more messages. And lets say that each attachement is smaller than limit size.
Im using python 2.7 (email, smtplib modules).
Any suggestions, samples, links.. would be appreciated.
Ok, I found that out :)
import smtplib
smtp = smtplib.SMTP('server.name')
smtp.ehlo()
max_limit_in_bytes = int( smtp.esmtp_features['size'] )
This returns size limit (in bytes) of entire email (with header, subject, message text...).
精彩评论