Send email with php (method 1)_PHP tutorial

WBOY
Release: 2016-07-13 17:51:58
Original
1001 people have browsed it

[html]
1. Example:
[html]
1. $content ="ceshi";
2. $technicalemail="www.2cto.com";
3. $headers = "From: =?utf-8?B?".base64_encode('chenglong')."?= <$technicalemail>rn";
4.
5. $content = strip_tags($content);
6. $a = @mail($technicalemail,'=?utf-8?B?'.base64_encode('Error submitted').'?=',$content,$headers);
7. if($a)
8. {
9. echo 'Email sent successfully! ';
10. }
Send via mail() function:
1. Need to configure php.ini email information
Open the php.ini configuration file and configure the red position
; For Win32 only.
                  SMTP = localhost --- If sendmail is installed on this machine, this means using the local mail server, which can also be an IP address, and the server domain name
                smtp_port = 25                                                                                                                                                                                                     smtp_port =                                                                     ; For Win32 only.
;sendmail_from = www.2cto.com ---Writable or not Remove the semicolon here
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
                ;sendmail_path =                                                           2.mail() function
The mail() function allows sending emails directly from scripts
The mail() function returns a boolean value. It returns true if successful and false
on failure.  
        mail(to,subject,message,headers,paeameters);
                         
to --Required, specifies the recipient of the email
               subject – required, specifies the subject of the email, this parameter cannot contain any newline characters
​​​​​ message --Required, specifies the message to be sent
headers --optional, specifies additional headers, such as from, Cc and Bcc. You can refer to some information
Parameters --optional, specifies additional parameters for the sendmail program
3. In php.ini, remove the ";" in front of extension=php_imap.dll
                                                                        
Author: Vericlongmore

http://www.bkjia.com/PHPjc/478152.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478152.htmlTechArticle[html] 1.span style=font-size:18px;Example:/span [html] 1. $ content =ceshi; 2. $technicalemail=www.2cto.com; 3.$headers = From: =?utf-8?B?.base64_encode(chenglong).?= $technicalemai...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template