Python Send mail function module

Source: Internet
Author: User

Send mail function function

1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 ImportSmtplib4  fromEmail.mime.textImportMimetext5  fromEmail.utilsImportformataddr6 defEmail (message):7msg = mimetext (Message,'Plain','Utf-8')8msg[' from'] = FORMATADDR (["Greatly",'[email protected]'])9msg[' to'] = FORMATADDR (["Little",' 2721593215@qq. com'])Tenmsg['Subject'] ="Ghost Valley Alarm System" One  AServer = Smtplib. SMTP ("smtp.126.com", 25) -Server.login ("[email protected]","n1049759078") -Server.sendmail ('[email protected]', [' 2721593215. com',], msg.as_string ()) the server.quit () - if __name__=='__main__': -CPU = 100 -Disk = 80 +RAM = 60 -      forIinchRange (1): +         ifCPU > 80: AAl = u"There 's a problem with the CPU" at Email (AL) -         ifDisk > 70: -Al = u"disk's gone wrong." - Email (AL) -         ifRam > 90: -Al = u"There 's a problem with Ram" inEmail (All)

Python Send mail function module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.