In php, the email sending function mail () is provided. We can use this function to send emails directly. Below I will introduce some common email sending instances. The simplest is the mail function.
Example
The Code is as follows:
Copy
Android Development may encounter how to send mail trouble, before I also checked the relevant documents, Bo Friends also shared a lot of ways to send mail, a total of 3 kinds of put, I carefully read the next, found that some talk too complicated
#发送邮件函数function Send_mail () {#定义邮件发送列表maillist = ([email protected][email protected][email protected]) if ["$" = = "Gateway"]; Then to mail in ${maillist[*]};d o echo "Cannot ping gateway, check network" | Mail-s "PI (10.78.1.122)
Configuration
工欲善其事, its prerequisite. First, let's take windows as an example to illustrate how to configure local mail.
Download Attachment Sendmail.zip-Extract to any path, modify Sendmail.ini, modify the following information as needed.
Note: The PHP environment is fully configured, refer to http://www.cnblogs.com/homezzm/archive/2012/08/01/2618062.html1. Local Windows needs to install SMTP server, we recommend using free SMTP server, link--http://www.softstack.com/freesmtp.html2.
Take Ubuntu as an example Modify PHP.ini, if it is php-fpm, need to modify 2 php.ini files Sendmail_from = "[email protected]"//email sent to the mailbox, must and from the corresponding Sendmail_path = "Sendmail-t-i-f [email protected]" Install or
First step: In the online down a Phpmailer plugin, plug-in address "http://www.php.cn/Download decompression, here we only need to use two of them, as shown in:
Place the class.phpmailer.php and class.smtp.php two files respectively into
PHP implementation of the mail-sending class, two ways:
SMTP mode and mail function mode.
Code:
sendfrommail = =) {$this->sendfrommail = $t his->smtp_user; }} Public Function Send ($mail _to = ", $subject =", $message = ") {if ($mail
This article is mainly for you to introduce the PHP SMTP implementation of the Send mail function, with a certain reference value, interested in small partners can refer to
Specific content is as follows
debug = false; $this->smtp_port = $smtp
This article mainly introduces the php mail function to send UTF-8 encoding Chinese mail Title garbled solution, need friends can refer to recently encountered a problem, the title of a UTF-8-encoded Chinese email is garbled while the mail body is
I use the Phpmailer class to do the Send mail function, prompting 500 error internal Server error;
Call code should be no problem, connect to the online instance write,
Do you need any other steps or configurations before you can send the message?
Example The code is as follows:Copy code Function send_mail ($ from, $ to, $ subject, $ message){If ($ from = "") {$ From = 'future memories '; // sender address }$ Headers = 'Mime-Version: 100'. "rn ";$ Headers. = 'content-type:
How does the Mail function determine if the send is successful?
The feeling that the manual was written did not detect this step. And in principle it is impossible to get a mark of success. After all, the speed of executing PHP and the delivery of
A script that sends an e-mail message may be one of the most common scripts you can find on a Web site, although it's simple, a mail script can sometimes make programmers very frustrated. There is a function called mail () in PHP that only needs to
Android Development may encounter how to send mail trouble, before I also checked the relevant documents, Bo Friends also shared a lot of ways to send mail, a total of 3 kinds of put, I carefully read the next, found that some talk too complicated
This article to you to share the QQ mailbox as an example to introduce the PHP implementation of automatic e-mail function code, interested friends refer to it
Recently done a mailbox verification function, studied for a while, took care of the
This article mainly and you introduce the PHP SMTP implementation of the sending mail function, with a certain reference value, interested in the small partners can refer to, hope to learn how to use the SMTP implementation of PHP to send
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.