php Send mail (method one) _php tutorial

Source: Internet
Author: User
Tags php send mail
[HTML]
1. Example:
[HTML]
1. $content = "Ceshi";
2. $technicalemail = "www.2cto.com";
3. $headers = "From: =?utf-8?" B? ". Base64_encode (' Chenglong '). "? = < $technicalemail >\r\n ";
4.
5. $content = Strip_tags ($content);
6. $a = @mail ($technicalemail, ' =?utf-8? B? '. Base64_encode (' Commit error '). '? = ', $content, $headers);
7. if ($a)
8. {
9. Echo ' Mail sent successfully! ';
10.}
Sent via the Mail () function:
1, need to configure php.ini mail message
Open the PHP.ini configuration file and configure the red location
; For Win32 only.
SMTP = localhost---If the sendmail is installed, this means using a local mail server, an IP address, and a server domain name
Smtp_port =---port number
; For Win32 only.
Sendmail_from = www.2cto.com---can be written not to write the semicolon removed here
; For Unix only. Supply arguments as well (default: "Sendmail-t-i").
; sendmail_path = path to----mail server
2.mail () function
The mail () function allows e-mail to be sent directly from the script
The Mail () function returns a Boolean value that returns true successfully and fails to return flase

Mail (to,subject,message,headers,paeameters);

To-required to specify the recipient of the message
Subject--required, specifies the subject of the message, which cannot contain any newline characters
Message-required to specify the messages to be sent
Headers-optional, specify additional headers such as FROM,CC and Bcc to refer to some information
Parameters--optional, specify additional parameters for the SendMail program
3. PHP.ini will Extension=php_imap.dll ";" in front of the

Author: vericlongmore

http://www.bkjia.com/PHPjc/478152.html www.bkjia.com true http://www.bkjia.com/PHPjc/478152.html techarticle [HTML] 1.span style=font-size:18px; instance:/span [HTML] 1. $content =ceshi; 2. $technicalemail =www.2cto.com; 3. $headers = from: =?utf-8? B?. Base64_encode (Chenglong).? = $technicalemai ...

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.