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 on several php forums.
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 values of the following five variables must be modified based on actual conditions.
- $ 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 the phpmailer class to send emails ';
- $ Content = 'Test the phpmailer class to send emails ';
- Sendmail ($ to, $ subject, $ content );
4. run sendmail. class. php after modification ..
Are your emails sent successfully? Tianma tests this code, is OK, witness: