Php email sending code

Source: Internet
Author: User
The following is an example code for sending email to a dating site. can you download it if you need it? Phpif ($ err) {echoquot; failed to send the email because: brgt;... the following is an example code for sending email to a dating website. you can download it if you need it.

 "; Foreach ($ err as $ a) {echo $ ."
";}} Class wrzc_netmail {/* var $ localhost; var $ smtp_accname; var $ smtp_password; var $ smtp_host; var $ from; var $ fromname; */function send ($ to, $ subject = 'no subobject', $ body) {$ localhost = $ this-> localhost; $ smtp_accname = $ this-> smtp_accname; $ smtp_password = $ this-> smtp_password; $ smtp_host = $ this-> smtp_host; $ from = $ this-> from; $ fromname = $ this-> fromname; $ lb = "rn"; $ headers = "content- Type: text/html; charset = "gbk" "; $ headers. = $ lb; $ headers. = "content-transfer-encoding: base64"; $ hdr = explode ($ lb, $ headers); if ($ body) {$ bdy = preg_replace ("/^. /",".. ", explode ($ lb, $ body);} $ smtp [] = array (" ehlo ". $ localhost. $ lb, "220,250", "ehlo error:"); $ smtp [] = array ("auth login ". $ lb, "334", "auth error:"); $ smtp [] = array (base64_encode ($ smtp_accname ). $ lb, "334", "authe Ntification error: "); $ smtp [] = array (base64_encode ($ smtp_password ). $ lb, "235", "authentification error:"); $ smtp [] = array ("mail from: <". $ from. "> ". $ lb, "250", "mail from error:"); $ smtp [] = array ("rcpt to: <". $. "> ". $ lb, "250", "rcpt to error:"); $ smtp [] = array ("data ". $ lb, "354", "data error:"); $ smtp [] = array ("from :". $ fromname. "<". $ from. "> ". $ lb ,"", ""); $ Smtp [] = array ("subject :". $ subject. $ lb, "", ""); $ smtp [] = array (":". $. $ lb, "", ""); foreach ($ hdr as $ h) {$ smtp [] = array ($ h. $ lb, "", "") ;}$ smtp [] = array ($ lb, "", ""); if ($ bdy) {foreach ($ bdy as $ B) {$ smtp [] = array (base64_encode ($ B. $ lb ). $ lb, "", "") ;}$ smtp [] = array (". ". $ lb, "250", "data (end) error:"); $ smtp [] = array ("quit ". $ lb, "221", "qu It error: "); $ fp = @ fsockopen ($ smtp_host, 25); if (! $ Fp) return "error: cannot conect '". $ smtp_host. "'By port 25"; while ($ result = @ fgets ($ fp, 1024) {if (substr ($ result, 3, 1) = "") {break ;}$ result_str; foreach ($ smtp as $ req) {@ fputs ($ fp, $ req [0]); if ($ req [1]) {while ($ result = @ fgets ($ fp, 1024) {if (substr ($ result, 3, 1) = "") {break ;}}; if (! Strstr ($ req [1], substr ($ result, 0, 3) {$ result_str [] = $ req [2]. $ result ;}}@ fclose ($ fp); return $ result_str;} function setlocalhost ($ localhost) {$ this-> localhost = $ localhost ;} function compute ($ smtp_accname) {$ this-> compute = $ smtp_accname;} function setsmtp_password ($ smtp_password) {$ this-> smtp_password = $ smtp_password;} function setsmtp_host (sm$ tp_host) {$ this-> smtp_host = $ smtp_host;} function setfrom ($ from) {$ this-> from = $ from;} function setfromname ($ fromname) {$ this-> fromname = $ fromname;} // unset


Permanent address:

Reprint at will ~ Please bring the tutorial URL ^

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.