Send mail using Phpmailer, phpmailer send mail _php tutorial

Source: Internet
Author: User

Send mail using Phpmailer, phpmailer send mail


Reprint http://blog.csdn.net/liruxing1715/article/details/7914974

Phpmailer's official website: http://phpmailer.worxware.com/

Phpmailer Latest class Library download address: "Click to download"

Phpmailer GitHub Download Address: Https://github.com/Synchro/PHPMailer, this page also provides examples of use, but not very comprehensive.

To use the method, see the code listing:

Header (' content-type:text/html; Charset=utf-8 ');
Require './phpmailerautoload.php ';
$mail = new Phpmailer;
$mail->issmtp (); Set up mail using SMTP
$mail->host = ' mail.wanzhao.com '; Mail server address
$mail->smtpauth = true; Enable SMTP authentication
$mail->charset = "UTF-8"; Set up message encoding
$mail->setlanguage (' zh_cn '); Set Error Chinese Tips
$mail->username = ' wanzhao@wanzhao.com '; SMTP user name, which is the personal email address
$mail->password = ' www123456 '; SMTP password, which is the personal mailbox password
$mail->smtpsecure = ' TLS '; Set enable encryption, note: The Php_openssl module must be turned on
$mail->priority = 3; Set message Priority 1: High, 3: normal (Default), 5: Low
$mail->from = ' liruxing@wanzhao.com '; Sender e-mail address
$mail->fromname = ' ru Li star '; Sender Name
$mail->addaddress (' liruxing1715@163.com ', ' Lee '); Add recipient
$mail->addaddress (' ellen@example.com '); Add multiple Recipients
$mail->addreplyto (' info@example.com ', ' information '); Add a reply to a person
$mail->addcc (' liruxing1715@sina.com '); Add cc person
$mail->addcc (' 512848303@qq.com '); Add multiple cc people
$mail->confirmreadingto = ' liruxing@wanzhao.com '; Add a Send receipt e-mail address, that is, when the recipient opens the message, asks if receipts have occurred
$mail->addbcc (' 734133239@qq.com '); Add encrypted send, Mail header will not display the secret send the person information
$mail->wordwrap = 50; Set 50 characters for line wrapping
$mail->addattachment ('./1.jpg '); Add an attachment
$mail->addattachment ('/tmp/image.jpg ', ' one pic '); Add multiple Attachments
$mail->ishtml (TRUE); Set the message format to HTML
$mail->subject = ' Here is the theme ';
$mail->body = ' This is the HTML information BodyIn bold!. Time: '. Date (' y-m-d h:i:s ');
$mail->altbody = ' This is the principal in plain text for non-html mail clients ';

if (! $mail->send ()) {
Echo ' Message could not being sent. ';
Echo ' Mailer Error: '. $mail->errorinfo;
Exit
}

Echo ' Message has been sent ';

http://www.bkjia.com/PHPjc/954467.html www.bkjia.com true http://www.bkjia.com/PHPjc/954467.html techarticle use phpmailer send mail, phpmailer send mail reprint http://blog.csdn.net/liruxing1715/article/details/7914974 Phpmailer The official website: Http://phpmailer.worxware.com/PHP ...

  • 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.