cz-sjm 发表于 2015-9-15 08:46:49

XAMPP: How to send email remotely

  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 = &quot;taolin&quot;
   3:$from_email = &quot;taolin@*.com&quot;;
   4:$headers = &quot;From: $from_name <$from_email>&quot;;
   5:$body = &quot;Hi, \nThis is a test mail from $from_name <$from_email>.&quot;;
   6:$subject = &quot;Test mail from taolin&quot;
   7:$to = &quot;somewhere@*.com&quot;;
   8:   
   9:if (mail($to, $subject, $body, $headers)) {
10:    echo &quot;success!&quot;;
11:} else {
12:    echo &quot;fail…&quot;;
13:}
14:?>
页: [1]
查看完整版本: XAMPP: How to send email remotely