Use php sendmail for Windows Configuration

Source: Internet
Author: User

Using php sendmail, you are very curious about why the system will automatically send an email of registration information to the registrant's mailbox after the forum of a large company is registered, we also use a kernel-based forum program. Why does it fail to be set up by ourselves? Today I will decrypt it for you.

Let's take PHPBB as an example. The Forum kernel has already completed the Forum mail sending function. You only need to have a local SMTP forwarding service, most of the large company servers use UNIX or LIUNX, because these servers themselves have the role of the local SMTP service, you can directly send registration information to the registrant's mailbox, most of our personal websites are WINDOWS platforms. The ASP Forum is very insecure, and the ASPX forum is not open-source.

Although these two Forum architectures are very easy to use some SMTP servers related to IIS to solve the problem, they are all inherently inadequate. Many netizens are very fond of setting up forums with the PHP kernel, for example, PHPBB, PHPWIND, and so on are all capable of sending emails to the Forum. However, PHP is naturally favored by LIUNX, so there are not many SMTP support in WINDOWS, is it impossible to use the php sendmail configuration method in Windows, but it is not a dead end. Now I will tell you how to solve the php sendmail configuration problem in WINDOWS.

1. Use php sendmail to modify the x: \ xampp \ sendmail. ini example and modify the following information:

 
 
  1. smtp_server=mail.vhost.tw  
  2. auth_username=sendmail@vhost.tw  
  3. auth_password=Xca1Bq 

2. Use php sendmail to modify the x: \ xampp \ apache \ bin \ php. ini example and modify the following information:

 
 
  1. [mail function]  
  2. ; For Win32 only.  
  3. ;smtp_port = 25 
  4. ; For Win32 only.  
  5. ;sendmail_from =   
  6. ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").  
  7. sendmail_path = "E:\xampp\sendmail\sendmail.exe -t" 
  8.  

3. Restart Apache and complete the configuration!

4. Use the php sendmail Pull mail () function

 
 
  1. <'Php
  2. $ Now = date ("Y-m-d h: I: s ");
  3. $ From_name = 'courier sender ';
  4. $ From_email =
  5. $ Headers = 'from: $ from_name <$ from_email> ';
  6. $ Body = 'Hi, \ n. This is a Response Letter from $ from_name <$ from_email> .';
  7. $ Subject = '[$ now] sending a delayed mail ';
  8.  
  9. If (mail ($ to, $ subject, $ body, $ headers )){
  10. Echo "success! ";
  11. } Else {
  12. Echo "fail... ";
  13. }
  14. '>
  15.  

In this way, the configuration of using php sendmail in Windows is successfully completed!

Article Reprinted from network management: http://www.bitscn.com/ OS /windows/201005/186613.html

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.