Friends who have learned asp may know that the jmail component uses a common mailbox sending function in asp. to call the jmail function in php, we need to use the com component for operations, let's first introduce the format. the code is as follows: $ Jmail... friends who have learned asp may know that the jmail component uses a common mailbox sending function in asp. to call the jmail function in php, we need to use the com component for operations, let's first introduce the format. the code is as follows:
$ Jmail = new com ("Jmail. message "); // instantiate a Jmail object $ Jmail-> SiLent = true; // if it is set to True, Jmail will not prompt errors and will only return True and False $ Jmail-> LogGing = false; // whether to enable logs $ Jmail-> CharSet = "UTF8 "; // Set the string encoding $ Jmail-> ContentType = "Text/html"; // The Mail format is HTML format $ Jmail-> MailServerUsername = 'mail user name '; $ Jmail-> MailServerPassword = 'mail password '; $ Jmail-> MailServerAddress = 'smtp server address' $ Jmail-> FromName = 'sender name '; $ Jmail-> From = 'sender address'; $ Jmail-> AddRecipient ('recipient address'); $ html = 'Email body '; $ Jmail-> Subject = 'Email title'; $ Jmail-> Body = $ html; $ JmailError = $ Jmail-> Send ($ Jmail-> MailServerAddress ); if ($ JmailError) {echo 'sent successfully ';}
The instance code is as follows:
Silent = true; // block exception errors $ jmail-> charset = 'gb2312'; // Otherwise, Chinese characters will be garbled $ jmail-> From = 'web535000 @ 163.com '; // theoretically, it can not be the same as the sender address, but it cannot be used for several attempts with 163. you can change it to the same one. $ jmail-> FromName = 'botest '; $ jmail-> AddRecipient ('abc1 @ 163.com '); // you can add multiple email recipients. // $ jmail-> AddRecipient ('abc2 @ 163.com '); // $ jmail-> AddRecipient ('abc3 @ 163.com '); $ jmail-> Subject = 'Email test. '; $ jmail-> Body =' this is test email. '; $ jmail-> MailServerUserNam E = 'web535000 @ 163.com '; // email sending account $ jmail-> MailServerPassword = '2016 '; // try {$ email = $ jmail-> Send ('smtp .163.com '); if ($ email) echo 'sent successfully '; else echo 'sending failed';} catch (Exception $ e) {echo $ e-> getMessage () ;}?>
Article address:
Reprint at will ^ please include the address of this article!