简体   繁体   中英

why can't i send email using php?

I have done the setting in sendmail.ini and php.ini so that I can send email by using gmail. The recipient is my hotmail. When I open my hotmail, nothing is received from my gmail. Can anyone help me with that? below is my php code:

<?php
    $to = 'kill_stealer90@hotmail.com';
    $subject = 'hello';
    $message = 'why i so pro';
    $headers = 'From:jackychickenchan@gmail.com';
    if (mail($to,$subject,$message,$headers)){
        echo("<p>sent</p>");
    }else{
        echo("<p>failed</p>");
    }
?>

and here is my sendmail.ini setting

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=465

smtp_ssl=auto

auth_username=jackylonelyboy+gmail.com
auth_password=nemesis90

and here is my php.ini setting

; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = smtp.gmail.com
; smtp_port = 465

You didn't uncomment your SMTP server. Take the semi-colons out of the SMTP and port lines in your php.ini.

我认为您应该使用jackylonelyboy@gmail.com代替jackylonelyboy+gmail.com作为身份验证的用户名。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM