In php, there are several ways to send emails:
You can directly call the system's mail() function to complete, but the premise is that you are in php. The mail has been configured in the ini file.
Connect to an external SMTP server through SMTP authentication in a PHP script and send emails.It is recommended to use the Mail class in the PEAR extension. It has powerful functions: it can support emails in plain text and HTML formats; encoding can be set for each field, and correct configuration will not cause Chinese garbled characters; it can support attachments, etc.You can use the pear install Mail command on the server to quickly install it. Students who do not have sufficient server permissions can also directly download the PHP source code of the class and include it.
You can use the PHPMailer class to send emails.
Other methods, such as using socket to send emails.
The following are the various PHP email class libraries summarized by our PHP Chinese website. Interested friends can enter the website class library download page to download and learn.
1.Full version of php email sending class
Full version of php email sending class supports sending plain text emails and HTML format emails, and can have multiple recipients. Multiple CC, multiple secret CC, emails with attachments, required php extensions, sockets and Fileinfo.
2.PHP class for sending emails via Socket
php smtp Socket class code for sending emails, SMTP server provider, can be domain name or IP address, SMTP needs Set the value of authentication to 1, and the value to 0 if authentication is not required. Most SMTP service providers now require verification. If you are not sure, please contact your SMTP service provider.
3.Full-featured PHP email class
Full-featured PHP email class, not only can send emails in html format, but also can send attachments, function setTo ($inAddress): The address used to process emails. The parameter $inAddress contains one or more strings and email address variables. Use commas to separate multiple email addresses. The default return value is true.
PHPMailer is a PHP function package for sending emails. The functions it provides include: specifying multiple recipients, CC addresses, BCC addresses and reply addresses when sending emails. Supports multiple email encodings including: 8bit, base64, binary and quoted-printable. Supports SMTP verification. Supports Redundant SMTP server. Supports emails with attachments and emails in Html format. Customizable email headers. Supports embedding images in emails. Flexible debugging. Tested and compatible SMTP servers include: Sendmail, qmail, Postfix, Imail, Exchange, etc. Can run on any platform.
5.Two classes for sending emails in php
Two classes for sending emails in php. You need to use php to send emails. You don’t want to be as complicated as PHPmailer. Find it. Go, I finally found a useful one, share it, PHP email sending class, which contains two files in total. SMTP server, SMTP server port, SMTP server user mailbox.
This email sending function uses a foreign open source mail class.
Things to note:
Character set settings for emails, $mail->CharSet = "GB2312"; Specify the character set here! Here I only specify GB2312 because this way Outlook can display the email subject normally. I have tried setting it to utf-8 but it displays garbled characters in Outlook.
If you are sending an email in html format , then remember to also specify
If you want to use it to send mass emails, remember to modify the include file function, such as:require("phpmailer/class.phpmailer.php");Change to: require_once("phpmailer/class.phpmailer.php"); Otherwise, the class will be redefined.
Introducing a mail sending php class. To use the mail() function to send mail, you must have a server that does not require SMTP authentication. A mail server that can send emails. But current SMTP mail servers basically require authentication, so if you want to use it to send emails, you can only set up a local SMTP server that does not require authentication.
Here uses the 163 mailbox, SMTP server, connection port, user mailbox of the SMTP server, server account and password are required, prompts whether to use authentication, whether Display sent debugging information.
9.php Send Email With Attachment Class
Mainly introduces the sending email class with attachment implemented by PHP. It is a very common practical skill in PHP programming and is a very practical one. The functions are shared with everyone for your reference.
10.Use phpmail to send email encapsulation class
A use phpmail to send email encapsulation class. The default sending email address is 163. If you use other email addresses, please check by yourself. SMTP server configuration.
For more related class library downloads, please pay attention://m.sbmmt.com/xiazai/leiku
[Related class library recommendations]
2.php paging class code sharing: 2017 Download the latest 10 PHP paging class codes of the year
3.[php thumbnail class] Download the latest 10 libraries that use PHP to generate thumbnails
4.[php verification code class] Share 10 useful php verification code codes