In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "the use of PHP mail sending class PHPMailer". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the PHP email sending class PHPMailer.
PHPMailer is a mail sending class dedicated to the php language, which is very powerful and enriches the single mail () function of PHP itself. Support SMTP and even attachments.
How to use ◆:
Note before ☆: after decompression, there will be an examples folder in the package with "pop3_before_smtp_test.php" and "test1.php" files in it. Among them, * files teach basic usage (see below), while "test1.php" mainly introduces some new features, which are described in detail in "index.html" in the same folder, and another file "contents.html" is email content, which can be replaced with mail template later to increase email standardization and richness.
☆ basic method: pop3_before_smtp_test.php
< ?php require ‘class.phpmailer.php’; require ‘class.pop3.php’; $pop = new POP3(); // 建立对象,收邮件 $pop->Authorise ('pop3.example.com'
, 110,30, 'mailer',' password', 1)
/ / set the user information for receiving email
/ / pop3.example.com: pop3 server rewritten into mailbox
/ / for example, 163is pop3.163.com
/ / mailer: user name
/ / password: password
$mail = new PHPMailer ()
/ / create an object and send an email. If you just send an email, you can remove the above.
/ / the pop3 section and the inclusion of class.pop3.php
$mail- > IsSMTP ()
/ / unchanged
$mail- > SMTPDebug = 2
$mail- > IsHTML (true)
/ / whether to enable HTML mail to be sent. Default is false.
/ / to facilitate the use of "mail template" later, let's change it to true
$mail- > Host = 'relay.example.com'
/ / the server that sent the mail
/ / for example, 163mailbox is smtp.163.com
$mail- > From = 'mailer@example.com'
/ / your email address
$mail- > FromName = 'Example Mailer'
/ / your name
$mail- > Subject ='My subject'
/ / email title
$mail- > Body = 'Hello world'
/ / message content, where you can use the new feature to invoke the message
Template, see the back for details.
$mail- > AddAddress ('name@anydomain.
Com', 'First Last')
/ / recipient's mailbox and name
If (! $mail- > Send ())
{
Echo $mail- > ErrorInfo
}
? >
At this point, I believe you have a deeper understanding of "the use of PHP mail sending class PHPMailer". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.