In php, we have installed the mail component on the linux server and can directly use the mail function to send emails. for windows systems, we mostly use PHPMailer to send emails. here is a simple example. use PHPMailer... in php, we have installed the mail component on the linux server and can directly use the mail function to send emails. for windows systems, we mostly use PHPMailer to send emails. here is a simple example.
Use the PHPMailer class to send emails. the code is as follows:
$ Phpmailer = new PHPMailer (); $ phpmailer-> IsSMTP (); // use the smtp protocol to send $ phpmailer-> Host = 'smtp .163.com '; $ phpmailer-> SMTPAuth = true; $ phpmailer-> Username = '******'; // 163 email account @ the $ phpmailer-> Password = '*******' in front of @ 163 '******'; // password // $ phpmailer-> From = '***** @ 163.com'; // email address $ phpmailer-> FromName = 'yanjiadong '; $ phpmailer-> Subject = 'Welcome to register, your activation mail'; $ phpmailer-> Body = 'click to activate'; // Add the recipient $ phpmailer-> Add Address ('********* @ qq.com', 'Username'); // send an echo $ phpmailer-> send ()? 'OK': 'fail ';
Note that you can search for phpmailer components by Baidu.