Phpmailer is a mail-sending class specifically for the PHP language, which is very powerful and enriches PHP's own single mail () function. Support SMTP and even accessories.
Phpmailer complies with LGPL authorization and can be downloaded free of charge, the current version is Phpmailer v2.2.1 updated on November 16, 2007.
Download Address: HTTP://PHPMAILER.CODEWORXTECH.COM/INDEX.PHP?PG=SF&P=DL
Note: The suffixes of the download are. tar.gz and. zip, in fact they contain the same files, but the compression format is different. tar.gz after a double compression, the file is smaller, WinRAR software can correctly extract the two formats.
How to use:
☆ Pre-note: After decompression, the package will have a examples folder, there are "pop3_before_smtp_test.php" and "test1.php" two files. The first of these files is the basic use of the professor (see below), while "test1.php" mainly introduces some new features, these are in the same folder "Index.html" to make a detailed description, the other file "contents.html" is the message content, You can later replace the message template to increase the normalization and enrichment of messages.
☆ Basic Method: pop3_before_smtp_test.php
- < ? PHP
- Require ' class.phpmailer.php ';
- Require ' class.pop3.php ';
- $ Pop = New POP3 ();
- Building objects, receiving mail
- $pop- > authorise (' pop3.example.com '
, Mailer, ' n ', ' password ', 1);
- Set up user information for receiving messages
- Pop3.example.com: POP3 server rewritten as a mailbox
- For example, 163 is pop3.163.com
- Mailer: User Name
- Password: password
- $ Mail = New Phpmailer ();
- Set up an object, send an e-mail, if only e-mail can be removed above
- POP3 part and the inclusion of class.pop3.php
- $mail- > issmtp ();
- Not change
- $mail- > Smtpdebug = 2 ;
- $mail- > ishtml (TRUE);
- Whether to enable the sending of HTML mail support, the default is False,
- To facilitate the use of the "Mail template" later, we changed it to True
- $mail- > Host = ' relay.example.com ';
- The server that sent the mail
- For example, 163 mailbox is smtp.163.com
- $mail- > from = ' mailer@example.com ';
- Your e-mail
- $mail- > FromName = ' Example Mailer ';
- Your name.
- $mail- > Subject = ' My subject ';
- Message header
- $mail- > Body = ' Hello world ';
- Message content, where you can invoke the message using the new feature
Template, see the detailed details behind.
- $mail- > addaddress (' Name@anydomain.
com ', ' first Last ');
- Recipient's mailbox and name
- if (! $mail->Send ())
- {
- Echo $mail- > errorinfo;
- }
- ?>
I hope that the above-mentioned Phpmailer knowledge can be used as reference learning materials for everyone.
http://www.bkjia.com/PHPjc/446175.html www.bkjia.com true http://www.bkjia.com/PHPjc/446175.html techarticle Phpmailer is a mail-sending class specifically for the PHP language, which is very powerful and enriches PHP's own single mail () function. Support SMTP and even accessories. Phpmailer Abide by ...