Phpmailer Send mail, can bring attachments

Source: Internet
Author: User
Tags mail
Example   require_once (' phpmailer/class.phpmailer.php '); Introduction of Phpmailer file require_once (' phpmailer/class.smtp.php ');         $mail =new Phpmailer (); Instantiate Phpmailer class       $mail->issmtp ();       $mail->charset= ' UTF-8 ';       $mail->addaddress (123@163.com); Recipient mailbox       $mail->body= $content; Send content       $mail->from=from@163.com; Sender's mailbox from@163.com          $mail->fromname= "Zjsupport";  //the name of the sender       $mail->subject= "title";    //Mail title       $mail->host= "smtp.163.com"; SMTP server         $mail->smtpauth=true;  //Open SMTP Service       $mail->ishtml (true);       //send attachments      $ Mail->addattachment (Path,name); Path is the attachment's save path name is the name of the attachment                           &NBSP ;                                       &NB Sp      //can upload multiple attachments, copy exactly the same   $mail->addattachment (path,name); Code on line           $mail->username= "from@163.com";//Sender's mailbox       $mail-> password= "123456"//Sender Mailbox password            if ($mail->send ()) { //To determine if the message was sent successfully   & nbsp   echo "Success";      }else{        $email _error= $email _error. ";". $val;  //fails to send the failed mailbox to the character channeling                  if ($email _error== "") {  &NB Sp   echo "email_success";      }else{      echo $email _error      

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.