PHP Email (126 Email and phpmailer Open source)

Source: Internet
Author: User
Tags php email
I. First DOWNLOAD Phpmailer

Https://github.com/chenlian2015/phpmailer.git


Two. In the downloaded directory,

class.phpmailer.php

class.smtp.php

Two copies of files to your project directory


Three. Use

 CharSet = "GBK";//Set the message encoding, the default iso-8859-1, if the Chinese language must be set, otherwise garbled $mail->issmtp ();                     Set $mail->smtpdebug = 1 using the SMTP service;                  Enable the SMTP debugging feature//1 = errors and messages//2 = messages only $mail->smtpauth = true;                 Enable the SMTP authentication feature//$mail->smtpsecure = "SSL";      Security protocol, can be commented out $mail->host = ' smtp.126.com ';                   SMTP server $mail->port = 25;  The port number of the SMTP server $mail->username = ' Write your 126 mailbox here ';            SMTP server user name, PS: I hit the $mail->password = ' Write your password here ';    SMTP server password $mail->setfrom (' Write here your 126 mailbox ', ' who ');    $mail->addreplyto (' Write here what you want to send to the mailbox ', ' name ');    $mail->subject = $subject; $mail->altbody = ' To view the message, please use an HTML compatible email viewer! ';    Optional, comment out and test $mail->msghtml ($body);    $address = $to;    $mail->addaddress ($address, ');      $mail->addattachment ("windows.pdf"); Attachment//$mail-&Gt AddAttachment ("Images/phpmailer_mini.gif");    Attachment if (! $mail->send ()) {echo ' Mailer Error: '. $mail->errorinfo; } else {echo "message sent! Congratulations, the Mail was sent successfully!    "; }}postmail (' Write here what you want to send to the mailbox ', ' My subject ', ' Lala '); >
  • 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.