Stable and proven smtp mail sending class (please pay for the usage), thank you very much

Source: Internet
Author: User
Find a stable and proven smtp mail class (please pay for the usage). thank you very much! I have found a few, some cannot be used, some cannot be sent, and some don't have the body; some have the body, but if I haven't sent a few, I will say & quot; the account has been locked & quot ;, the discuzphpwind emails are too complicated to be separated! Thank you !!! Use the mail function and iis to obtain smtp, which is the old postal address to find a stable and proven smtp mail sending class (please pay for the usage). thank you very much!
I have found a few, some cannot be used, some cannot be sent, and some have no text;
There is another body, but if you don't send a few emails, you can say "the account has been locked". The discuz \ phpwind emails are too complicated to be separated!

Thank you !!!
Use the mail function and iis to get smtp. it is also the old postal address invalid! No way to change the address: "aaa <[email protected]>" or "[email protected]" is incorrect.

If it is large, [email protected], please send it to your mailbox. thank you!
Email recipients can receive up to 20 messages. if the email is correct, the email can receive up to 60 messages!

------ Solution --------------------
Class smtp
{
/* Public Variables */
Var $ smtp_port;
Var $ time_out;
Var $ host_name;
Var $ log_file;
Var $ relay_host;
Var $ debug;
Var $ auth;
Var $ user;
Var $ pass;

/* Private Variables */
Var $ sock;

/* Constractor */
Function smtp ($ relay_host = "", $ smtp_port = 25, $ auth = false, $ user, $ pass)
{
$ This-> debug = FALSE;
$ This-> smtp_port = $ smtp_port;
$ This-> relay_host = $ relay_host;
$ This-> time_out = 30; // is used in fsockopen ()
$ This-> auth = $ auth; // auth
$ This-> user = $ user;
$ This-> pass = $ pass;
$ This-> host_name = "localhost"; // is used in HELO command
$ This-> log_file = "";
$ This-> sock = FALSE;
}

/* Main Function */
Function sendmail ($ to, $ from, $ subject = "", $ body = "", $ mailtype, $ cc = "", $ bcc = "", $ additional_headers = "")
{
$ Mail_from = $ this-> get_address ($ this-> strip_comment ($ from ));
$ Body = ereg_replace ("(^ | (\ r \ n) (\.)", "\ 1. \ 3", $ body );
$ Header. = "MIME-Version: 1.0 \ r \ n ";
If ($ mailtype = "HTML ")
{
$ Header. = "Content-Type: text/html \ r \ n ";
}
$ Header. = "To:". $ to. "\ r \ n ";
If ($ cc! = "")
{
$ Header. = "Cc:". $ cc. "\ r \ n ";
}
$ Header. = "From: $ from <". $ from. "> \ r \ n ";
$ Header. = "Subject:". $ subject. "\ r \ n ";
$ Header. = $ additional_headers;
$ Header. = "Date:". date ("r"). "\ r \ n ";
$ Header. = "X-Mailer: By Redhat (PHP/". phpversion (). ") \ r \ n ";
List ($ msec, $ sec) = explode ("", microtime ());
$ Header. = "Message-ID: <". date ("YmdHis", $ sec ). ". ". ($ msec * 1000000 ). ". ". $ mail_from. "> \ r \ n ";
$ TO = explode (",", $ this-> strip_comment ($ ));

If ($ cc! = "")
{
$ TO = array_merge ($ TO, explode (",", $ this-> strip_comment ($ cc )));
}
If ($ bcc! = "")
{
$ TO = array_merge ($ TO, explode (",", $ this-> strip_comment ($ bcc )));
}
$ Sent = TRUE;
Foreach ($ TO as $ rcpt_to)
{
$ Rcpt_to = $ this-> get_address ($ rcpt_to );
If (! $ This-> smtp_sockopen ($ rcpt_to ))
{
$ This-> log_write ("Error: Cannot send email to". $ rcpt_to. "\ n ");
$ Sent = FALSE;
Continue;
}
If ($ this-> smtp_send ($ this-> host_name, $ mail_from, $ rcpt_to, $ header, $ body ))
{
$ This-> log_write ("E-mail has been sent to <". $ rcpt_to. "> \ n ");
}
Else
{
$ This-> log_write ("Error: Cannot send email to <". $ rcpt_to. "> \ n ");
$ Sent = FALSE;
}
Fclose ($ this-> sock );
$ This-> log_write ("Disconnected from remote host \ n ");
}
Return $ sent;

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.