{"id":128,"date":"2009-04-30T13:23:37","date_gmt":"2009-04-30T05:23:37","guid":{"rendered":"http:\/\/j178.mtgbb.com\/214"},"modified":"2011-02-28T17:56:16","modified_gmt":"2011-02-28T09:56:16","slug":"phpmailer","status":"publish","type":"post","link":"https:\/\/j178.mtgbb.com\/?p=128","title":{"rendered":"phpmailer"},"content":{"rendered":"<p>phpmailer \u662f\u5728 php \u5e95\u4e0b\u4e00\u500b\u5f88\u4e0d\u932f\u7684\u9001\u4fe1 package<\/p>\n<p>\u5177\u6709\u767c\u7fa4\u7d44\u4fe1\u4ef6\u3001\u767c\u9001\u9644\u4ef6\u3001\u5d01\u5165 image \u7b49\u4e00\u5b9a\u6703\u7528\u5230\u7684\u529f\u80fd<\/p>\n<p>\u8a31\u591a php base \u7684 web \u7a0b\u5f0f\u6703 reference \u9019\u500b package, \u4e0d\u7528\u91cd\u8907\u958b\u767c\u76f8\u540c\u7684\u529f\u80fd<\/p>\n<p>\u76f8\u95dc\u8cc7\u8a0a\u53ef\u4ee5\u5230\u00a0 <a href=\"http:\/\/phpmailer.codeworxtech.com\/index.php?pg=sf&amp;p=dl\" target=\"_blank\">phpmailer<\/a> \u700f\u89bd\u76f8\u95dc\u8cc7\u6599<\/p>\n<p><!--more--><\/p>\n<p>sample code:<\/p>\n<pre lang=\"php\" line=\"1\">\r\nrequire_once '..\/class.phpmailer.php';\r\n\r\n$mail = new PHPMailer(true); \/\/defaults to using php \"mail()\"; the true param means it will throw exceptions on errors, which we need to catch\r\ntry {\r\n  $mail->AddReplyTo('name@yourdomain.com', 'First Last');\r\n  $mail->AddAddress('whoto@otherdomain.com', 'John Doe');\r\n  $mail->SetFrom('name@yourdomain.com', 'First Last');\r\n  $mail->AddReplyTo('name@yourdomain.com', 'First Last');\r\n  $mail->Subject = 'PHPMailer Test Subject via mail(), advanced';\r\n  $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; \/\/ optional - MsgHTML will create an alternate automatically\r\n  $mail->MsgHTML(file_get_contents('contents.html'));\r\n  $mail->AddAttachment('images\/phpmailer.gif');      \/\/ attachment\r\n  $mail->AddAttachment('images\/phpmailer_mini.gif'); \/\/ attachment\r\n  $mail->Send();\r\n  echo \"Message Sent OK<P><\/P>n\";\r\n} catch (phpmailerException $e) {\r\n  echo $e->errorMessage(); \/\/Pretty error messages from PHPMailer\r\n} catch (Exception $e) {\r\n  echo $e->getMessage(); \/\/Boring error messages from anything else!\r\n}\r\n<\/pre>\n<p>\u76f8\u95dc\u7db2\u7ad9\uff1a [<a href=\"http:\/\/www.91php.com\/html\/PHP\/200812\/07-5314.html\" target=\"_blank\">phpmailer \u76f8\u95dc\u51fd\u6578\u7ffb\u8b6f<\/a>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>phpmailer \u662f\u5728 php \u5e95\u4e0b\u4e00\u500b\u5f88\u4e0d\u932f\u7684\u9001\u4fe1 package \u5177\u6709\u767c\u7fa4\u7d44\u4fe1\u4ef6\u3001\u767c\u9001\u9644\u4ef6\u3001\u5d01\u5165 ima &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[56],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=128"}],"version-history":[{"count":0,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions"}],"wp:attachment":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}