XAMPP: How to send email remotely
时间:2010-08-26 来源:creasy
To get your php script send the email using XAMPP. you need:
1. Modify your sendmail.ini inside the XAMPP_HOME\sendmail\sendmail.ini, you need to concern with 3 variables here:
- smtp_server
- auth_username
- auth_password
2. Modify your php.ini file inside XAMPP_HOME\php\php.ini, uncomment the statement:
- sendmail_path = “C:\xampp\sendmail\sendmail.exe -t”
3. Use the Testing script to test:
1: <?php
2: $from_name = "taolin"
3: $from_email = "taolin@*.com";
4: $headers = "From: $from_name <$from_email>";
5: $body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
6: $subject = "Test mail from taolin"
7: $to = "somewhere@*.com";
8:
9: if (mail($to, $subject, $body, $headers)) {
10: echo "success!";
11: } else {
12: echo "fail…";
13: }
14: ?>
相关阅读 更多 +