发送邮件()php xampp yahoo

Can anyone help me? I am stuck with PHP mail() function, I have already set php.ini and sendmail.ini. I'm just using function mail($to,$subject,$content) and didn't work. I'm using localhost XAMPP.

This the php.ini file:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.mail.yahoo.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = jesus4way@yahoo.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"

Check server status

  • Start Mercury Mail Server from XAMPP Control Panel. Check if status is Running.
  • Open Mercury control panel (from XAMPP Panel or taskbar) and check if SMTP server status is Ready.
  • Send mail message to your own e-mail address from Mercury control panel and check if it fails or not.

PHP

Allow error reporting: error_reporting(E_ALL); and check for PHP errors and warnings.

Try to add header info to your mail() function:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "
" .
    'Reply-To: webmaster@example.com' . "
" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>