Phpmailer downloads and instructions and sample ____php

Source: Internet
Author: User
Tags base64 server port
https://github.com/Synchro/PHPMailer# Download Address
Http://phpmailer.worxware.com/index.php?pg=methods Method Description

Updated for Phpmailer v5.0.0

Methods (v5.0.0) Type Default Description
Set ($name, $value) String $name
String $value
Method provides ability for user to create own custom pseudo-properties (like X-headers, for example). Example use:
$mail->set (' x-msmail-priority ', ' Normal ');
Addcustomheader ($value) String $value Method provides ability for user to create own custom headers (like x-priority, for example). Example use:
$mail->addcustomheader ("X-priority:3");
Msghtml ($message) Evaluates the message and returns modifications for inline images and backgrounds. Sets the IsHTML () method to True, initializes altbody () to either a-text version of the message or default text.
IsMail () Boolean True Sets Mailer to send Message using PHP mail () function. (True, false or blank)
ISSMTP () Boolean Sets Mailer to send message using SMTP. If set to True, the other options are also available. (True, false or blank)
Issendmail () Boolean Sets Mailer to send is using the Sendmail program. (True, false or blank)
Isqmail () Boolean The Sets Mailer to send message using the QMail MTA. (True, false or blank)
Setfrom ($address, $name = "") String $address
String $name
Adds a ' from ' address.
AddAddress ($address, $name = "") String $address
String $name
Adds a ' to ' address.
ADDCC ($address, $name = "") String $address
String $name
Adds a "Cc" address. Note:this function works with the SMTP Mailer in Win32, not with the "mail" Mailer.
ADDBCC ($address, $name = "") String $address
String $name
Adds a "Bcc" address. Note:this function works with the SMTP Mailer in Win32, not with the "mail" Mailer.
Addreplyto ($address, $name = "") String $address
String $name
Adds a "reply-to" address.
Send () Creates message and assigns Mailer. The If is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error. Returns true on success and false on failure.
AddAttachment ($path, $name = "", $encoding = "base64",
$type = "Application/octet-stream")
String $path
String $name
String $encoding
String $type
Adds a attachment from path on the filesystem. Returns False if the file could not is found or accessed.
Addembeddedimage ($path, $cid, $name = "", $encoding = "base64",
$type = "Application/octet-stream")
String $path
String $cid
String $name
String $encoding
String $type
Adds an embedded attachment. This can include images, sounds, and just on any other document. Make sure to set the $type to a image type. For the JPEG images use "image/gif" with "Image/jpeg" and for GIF images. If You use the msghtml () method, there is no need to use Addembeddedimage () method.
Clearaddresses () Clears all recipients assigned in the to array. Returns void.
Clearccs () Clears all recipients assigned in the CC array. Returns void.
Clearbccs () Clears all recipients assigned in the BCC array. Returns void.
Clearreplytos () Clears all recipients assigned in the ReplyTo array. Returns void.
Clearallrecipients () Clears all recipients assigned in the To, CC and BCC array. Returns void.
Clearattachments () Clears all previously set filesystem, string, and binary attachments. Returns void.
Clearcustomheaders () Clears all custom headers. Returns void.

Http://phpmailer.worxware.com/index.php?pg=properties Property Description

Updated for Phpmailer v5.0.0

Property
(v5.0.0) Type Default Description
$Priority Public 3 Email Priority (1 = high, 3 = Normal, 5 = low)
$CharSet Public Iso-8859-1 Sets the CharSet of the message
$ContentType Public Text/plain Sets the content-type of the message
$Encoding Public 8bit Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable"
$ErrorInfo Public Holds the most recent mailer error message
$From Public Root@localhost Sets the "from" email address
$FromName Public Root User Sets the ' from ' name of the message
$Sender Public Sets the Sender email (return-path) of the message. If not empty, 'll be sent via-f to SendMail or as ' MAIL from ' in SMTP mode.
$Subject Public Sets the Subject of the message.
$Body Public Sets the message. This can is either an HTML or text body. If HTML then run ishtml (true).
$AltBody Public Sets the text-only body. This is automatically sets the email to multipart/alternative. This can is read by mail clients, that does not have HTML email capability such as Mutt. Clients that can read HTML would view the normal body.
$WordWrap Public 0 Sets word wrapping on the ' message to a given number of characters
$Mailer Public Mail method to send mail: ("Mail", "SendMail", or "SMTP").
$Sendmail Public /usr/sbin/sendmail Sets the path of the SendMail program.
$PluginDir Public Path to Phpmailer plugins. This are now only useful if the SMTP class are in a different directory than the PHP include path.
$ConfirmReadingTo Public Sets the email address of that a reading confirmation would be sent.
$Hostname Public Sets the hostname to use in Message-id and Received headers and as default HELO string. If empty, the value returned by server_name is used or ' localhost.localdomain '.
$Host Public localhost Sets the SMTP hosts. All hosts must is separated by a semicolon. Can also specify a different port for each host by using this format: [Hostname:port] (e.g. "smtp1.example.com:25;smtp 2.example.com "). The Hosts would be tried into order.
$Port Public 25 Sets the default SMTP server port.
$Helo Public Sets the SMTP HELO of the message (Default is $Hostname).
$SMTPAuth Public False Sets SMTP authentication. Utilizes the Username and Password variables.
$Username Public Sets SMTP username.
$Password Public Sets SMTP password.
$Timeout Public 10 Sets the SMTP server timeout in seconds. This function won't work with the Win32 version.
$SMTPDebug Public False Sets SMTP class debugging on or off.
$SMTPKeepAlive Public False Prevents the SMTP connection from being closed after each mail sending. The If is set to true then to close the connection requires a explicit call to Smtpclose ().
$SingleTo Public False Provides the "ability to have" to "field process individual emails, instead to sending to entire to addresses

Source: http://www.cnblogs.com/Liangw/archive/2013/01/30/2882579.html
use Phpmailer to complete mail delivery in PHP

<?php require ' phpmailerautoload.php ';

$mail = new Phpmailer;                               $mail->smtpdebug = 3;                                      Enable verbose debug output $mail->issmtp ();  Set Mailer to use SMTP $mail->host = ' smtp1.example.com;smtp2.example.com ';                               Specify main and backup SMTP servers $mail->smtpauth = true;                 Enable SMTP authentication $mail->username = ' user@example.com ';                           SMTP username $mail->password = ' secret ';                            SMTP password $mail->smtpsecure = ' TLS ';                                    Enable TLS encryption, ' SSL ' also accepted $mail->port = 587;
TCP port to connect to $mail->from = ' from@example.com ';
$mail->fromname = ' Mailer ';     $mail->addaddress (' joe@example.net ', ' Joe User ');               Add a recipient $mail->addaddress (' ellen@example.com '); The Name is optional $mail->addreplyto (' info@example.com ', ' information ');
$mail->addcc (' cc@example.com ');

$mail->addbcc (' bcc@example.com ');         $mail->addattachment ('/var/tmp/file.tar.gz ');    Add Attachments $mail->addattachment ('/tmp/image.jpg ', ' new.jpg ');                                  Optional name $mail->ishtml (TRUE);
Set email format to HTML $mail->subject = ' This is the Subject ';
$mail->body = ' This are the HTML message body <b>in bold!</b> ';

$mail->altbody = ' This are the body in plain text for non-html mail clients ';
    if (! $mail->send ()) {echo ' message could is not sent. '; Echo ' Mailer Error: '.
$mail->errorinfo; else {echo ' message has been sent ';}
 

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.