In-depth discussion of PHP mail sending class PHPMailer. PHPMailer is a mail sending class specifically used in php language. it has powerful functions and enriches PHP's single mail () function. Supports SMTP and even attachments. PHPMailer compliance
PHPMailer is a mail sending class specifically used in php language. it has powerful functions and enriches PHP's single mail () function. Supports SMTP and even attachments.
PHPMailer complies with the LGPL authorization and can be downloaded free of charge. The current version is PHPMailer v2.2.1 updated on July 22, November 16, 2007.
: Http://phpmailer.codeworxtech.com/index.php? Pg = sf & p = dl
Note: When downloading a file with a suffix of .tar.gz and. zip, all files contained in the file are compressed in different formats. .tar.gz is compressed in double mode and the file size is smaller. WinRAR can decompress these two formats correctly.
◆ Usage:
☆Note: After decompression, there will be an examples folder with "pop3_before_smtp_test.php" and "test1.php" files. The first file shows the basic usage (see below), while "test1.php" provides detailed instructions. another file named contents.html is the Mail content, which can be replaced with the mail template in the future, it is used to increase mail standardization and enrichment.
☆Basic method: pop3_before_smtp_test.php
- <? Php
- Require 'class. phpmailer. php ';
- Require 'class. pop3.php ';
- $ Pop = new POP3 ();
- // Create an object to receive emails
- $ Pop-> Authorise ('pop3 .example.com'
, 110, 30, 'mailer', 'password', 1 );
- // Set the email receiving user information
- // Pop3.example.com: the pop3 server that is rewritten to the mailbox
- // For example, 163 is pop3.163.com
- // Mailer: User name
- // Password: password
- $ Mail = new PHPMailer ();
- // Create an object and send an email. if you only send an email, you can remove the above
- // Pop3 and the inclusion of class. pop3.php
- $ Mail-> IsSMTP ();
- // Unchanged
- $ Mail-> SMTPDebug = 2;
- $ Mail-> IsHTML (true );
- // Whether HTML mail can be sent. the default value is false,
- // To facilitate the subsequent use of the "email template", we should change it to true
- $ Mail-> Host = 'relay .example.com ';
- // Email server
- // For example, the 163 email address is smtp.163.com.
- $ Mail-> From = 'mailer @ example.com ';
- // Your email address
- $ Mail-> FromName = 'example Mailer ';
- // Your name
- $ Mail-> Subject = 'My subobject ';
- // Mail title
- $ Mail-> Body = 'Hello World ';
- // Email content. you can use the new feature to call emails.
Template. for details, refer to the following section.
- $ Mail-> AddAddress ('name @ anydomain.
Com ', 'First last ');
- // Recipient's email address and name
- If (! $ Mail-> Send ())
- {
- Echo $ mail-> ErrorInfo;
- }
- ?>
We hope that the PHPMailer knowledge described above can be used as your reference.
Pure PHP's single mail () function. Supports SMTP and even attachments. PHPMailer complies...