{"id":358,"date":"2017-02-04T16:24:42","date_gmt":"2017-02-04T08:24:42","guid":{"rendered":"http:\/\/www.rainweb.site\/?p=358"},"modified":"2017-02-04T16:24:42","modified_gmt":"2017-02-04T08:24:42","slug":"python-article19","status":"publish","type":"post","link":"http:\/\/rain1024.com\/index.php\/2017\/02\/04\/python-article19\/","title":{"rendered":"\u90ae\u4ef6\u4e13\u9898&#8212;\u4f7f\u7528Python\u53d1\u9001\u90ae\u4ef6"},"content":{"rendered":"<h4>\u4eca\u5929\u51c6\u5907\u628a\u7b14\u8bb0\u91cc\u5173\u4e8epython\uff0cjava\uff0cphp\u5982\u4f55\u53d1\u9001\u90ae\u4ef6\u7684\u4ee3\u7801\u6574\u7406\u4e00\u4e0b\uff0c\u53d1\u5230\u535a\u5ba2\u91cc\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u5199\u7a0b\u5e8f\u7684\u7528\u7684\u6700\u591a\u7684\u5c31\u662f\u90ae\u4ef6\uff0c\u6bcf\u5929\u90fd\u8981\u63a5\u6536\u5404\u79cd\u90ae\u4ef6\uff0c\u4e3b\u6d41\u4e00\u4e9b\u7684\u90ae\u7bb1\u6211\u4e5f\u90fd\u6ce8\u518c\u4e86\uff0cgoogle\uff0c163\u90ae\u7bb1\uff0cqq\u90ae\u7bb1\uff0c\u963f\u91cc\u4e91\u90ae\u7bb1\uff0c\u4f46\u7528\u7684\u6700\u591a\u7684\u8fd8\u662f163\uff0c\u6240\u4ee5\u8fd9\u51e0\u7bc7\u6587\u7ae0\u4e5f\u90fd\u662f\u8bb2\u5982\u4f55\u4f7f\u7528163\u90ae\u7bb1\u53d1\u9001\u90ae\u4ef6\uff0c\u4f46\u9053\u7406\u90fd\u5dee\u4e0d\u591a\uff0c\u4f7f\u7528\u5176\u4ed6\u90ae\u7bb1\u7684\u66f4\u6539\u4e00\u4e0bsmtp\u5c31\u884c\u3002<br \/>\n##### \u4f7f\u7528\u4e4b\u524d\u8981\u8bb0\u5f97\u628a\u90ae\u7bb1\u7684smtp\u529f\u80fd\u90fd\u5f00\u4e86\uff0cqq\u90ae\u7bb1\u548c163\u90ae\u7bb1\u9ed8\u8ba4\u90fd\u6ca1\u6709\u5f00\u653e\u529f\u80fd\uff0c\u6fc0\u6d3b\u4ee5\u540e\u4f1a\u6709\u53e6\u5916\u4e00\u4e2a\u6388\u6743\u7801\uff0c\u8fd9\u65f6\u5019\u7528163\u5c31\u6bd4\u8f83\u65b9\u4fbf\uff0c\u56e0\u4e3a\u4ed6\u7684\u5bc6\u7801\u662f\u81ea\u5df1\u8bbe\u7f6e\u7684\uff0c\u800cqq\u90ae\u7bb1\u662f\u7ed9\u4e86\u4e00\u957f\u4e32\u6388\u6743\u7801\uff0c\u5f88\u9ebb\u70e6\u3002\u90ae\u4ef6\u53d1\u9001\u4ee5\u540e\u53ef\u80fd\u4f1a\u88ab\u89c6\u4e3a\u5783\u573e\u90ae\u4ef6\uff0c\u6240\u4ee5\u5982\u679c\u6ca1\u6709\u6536\u5230\u63d0\u9192\uff0c\u5c31\u53bb\u5783\u573e\u90ae\u4ef6\u91cc\u770b\u4e00\u770b\u3002<br \/>\n* \u4e0b\u9762\u662fpython\u53d1\u9001\u90ae\u4ef6\u7684\u6e90\u4ee3\u7801\uff0c\u6211\u53ea\u662f\u7528\u6765\u53d1\u9001\u6587\u672c\u6d88\u606f\uff0c\u6ca1\u6709\u9644\u4ef6\u7684\u529f\u80fd\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u53bb\u6df1\u5165\u7814\u7a76\u4e00\u4e0b\uff0c\u7b49\u8fc7\u6bb5\u65f6\u95f4\u6211\u6709\u9700\u6c42\u65f6\uff0c\u518d\u66f4\u65b0\u4e00\u7bc7\u5982\u4f55\u53d1\u9001\u9644\u4ef6\u7684\u535a\u6587\u3002<\/h4>\n<p>&nbsp;<\/p>\n<pre class=\"lang:python decode:true \">#-*- coding=utf-8 -*- #\u5982\u679c\u8981\u53d1\u9001\u4e2d\u6587\u7684\u5185\u5bb9\uff0c\u8fd9\u4e2a\u662f\u5fc5\u52a0\nimport smtplib\nfrom email.mime.text import MIMEText\nfrom email.header import Header\nsender = \"xxxxx@163.com\" #\u53d1\u9001\u65b9\u7684\u90ae\u7bb1\npassword = \"xxxxx\" #\u90ae\u7bb1\u7684\u6388\u6743\u7801\nreceiver = \"xxxxxx@mywiz.cn\" #\u63a5\u6536\u65b9\u7684\u90ae\u7bb1\nsubject = \"123\" #title\u90ae\u4ef6\u6807\u9898\nwords = \"46878\" #text\u90ae\u4ef6\u5185\u5bb9\nsmtpserver = 'smtp.163.com'\nmsg = MIMEText(words, 'plain', 'utf-8')#\u4e2d\u6587\u9700\u53c2\u6570\u2018utf-8'\uff0c\u5355\u5b57\u8282\u5b57\u7b26\u4e0d\u9700\u8981\nmsg['Subject'] = Header(subject, 'utf-8') #\u90ae\u4ef6\u6807\u9898\nmsg['from'] = sender #\u53d1\u4fe1\u4eba\u5730\u5740\nmsg['to'] = receiver #\u6536\u4fe1\u4eba\u5730\u5740\nsmtp = smtplib.SMTP()\nsmtp.connect('smtp.163.com')\nsmtp.login(sender, password)\nsmtp.sendmail(sender, receiver, msg.as_string())\nsmtp.quit()\nprint \"\u90ae\u4ef6\u53d1\u9001\u6210\u529f!\"<\/pre>\n<p>&nbsp;<\/p>\n<h4>\u4ee5\u4e0a\u4ee3\u7801\u662f\u6211\u6d4b\u8bd5\u8fc7\u7684\uff0c\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\uff0c\u6709\u95ee\u9898\u7684\u53ef\u4ee5\u53d1\u90ae\u4ef6\u8054\u7cfb\u6211\uff0c\u6211\u7684python\u662f2.7\uff0cIDE\u4f7f\u7528pycharm\uff0c\u8fd9\u91cc\u53ea\u662f\u6700\u7b80\u5355\u7684\u6e90\u7801\uff0c\u4f7f\u7528\u65f6\u5efa\u8bae\u5199\u6210\u4e00\u4e2a\u51fd\u6570\uff0c\u76f4\u63a5\u8c03\u7528\u5373\u53ef\uff0c\u6216\u8005\u76f4\u63a5\u4fdd\u5b58\u4e3a\u6587\u4ef6\uff0c\u518d\u5bfc\u5165<\/h4>\n<h4>\u8fd9\u662f\u6211\u5199\u7684\u90ae\u4ef6\u4e13\u9898\u91cc\u5176\u4ed6\u4e24\u7bc7\u53d1\u9001\u90ae\u4ef6\u7684\u535a\u6587<\/h4>\n<p>\u300b\u300b\u300b<a href=\"http:\/\/www.rainweb.site\/index.php\/2017\/02\/04\/java-article0021\/\" title=\"\u90ae\u4ef6\u4e13\u9898---\u4f7f\u7528java\u53d1\u9001\u90ae\u4ef6\">\u90ae\u4ef6\u4e13\u9898---\u4f7f\u7528java\u53d1\u9001\u90ae\u4ef6<\/a><br \/>\n\u300b\u300b\u300b<a href=\"http:\/\/www.rainweb.site\/index.php\/2017\/02\/04\/php-article0020\/\" title=\"\u90ae\u4ef6\u4e13\u9898---\u4f7f\u7528php\u53d1\u9001\u90ae\u4ef6\">\u90ae\u4ef6\u4e13\u9898---\u4f7f\u7528php\u53d1\u9001\u90ae\u4ef6<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u51c6\u5907\u628a\u7b14\u8bb0\u91cc\u5173\u4e8epython\uff0cjava\uff0cphp\u5982\u4f55\u53d1\u9001\u90ae\u4ef6\u7684\u4ee3\u7801\u6574\u7406\u4e00\u4e0b\uff0c\u53d1\u5230\u535a\u5ba2\u91cc\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u5199\u7a0b\u5e8f\u7684\u7528\u7684\u2026 <span class=\"read-more\"><a href=\"http:\/\/rain1024.com\/index.php\/2017\/02\/04\/python-article19\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":365,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[15],"tags":[58,94],"class_list":["post-358","post","type-post","status-publish","format-aside","has-post-thumbnail","hentry","category-python","tag-python","tag-email","post_format-post-format-aside"],"_links":{"self":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/comments?post=358"}],"version-history":[{"count":0,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/358\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media\/365"}],"wp:attachment":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media?parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/categories?post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/tags?post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}