PHP email function implementation code

Source: Internet
Author: User
No email server is required, and no built-in functions of mail are used. a class can be used. Using the phpmailer class, I wrote a custom function sendmail (), which is practical! I used to post this email function on several php forums. I will try again today... no email server is required, and no built-in functions of mail are used. a class can be used. Using the phpmailer class, I wrote a custom function sendmail (), which is practical!

I used to post this email function on several php forums. I will send it again today, because I want to attach a use example to today. if you still don't use it, I need to complete the php basic course.

1. prepare the sendmail. class. php file and phpmailer class download files.

2. after downloading, decompress phpmailer.rar to any directory on the server.

3. open sendmail. class. php and modify it as follows (the light yellow part is the variable value that must be modified)

// The following five variable values must be modified based on actual $ host = '61. 183.41.172 '; $ username = 'admin @ php95.com'; $ password = "******" $ from = 'admin @ php95.com '; $ fromname = 'tianma blog '; // set the value of the $ to $ subject $ content variable first, and then call the sendmail function to send an email $ to = 'nt2030 @ qq.com '; $ subject = 'Test phpmailer class to send mails '; $ content = 'Test phpmailer class to send mails'; sendmail ($ to, $ subject, $ content );

4. run sendmail. class. php after modification ..

Are your emails sent successfully? Tianma tests this code, is OK, witness:


Address:

Reprinted at will, but please attach the article address :-)

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.