从XAMPP servver发送邮件的麻烦

时间:2018-03-18 06:46:16

标签: php email

我一直在尝试从xampp发送邮件这么多次,因为我设置了所有必需的东西,但仍然没有邮件功能。

我尝试过以下步骤:

  1. ;

  2. php.ini文件中删除extension=php_openssl.dll
  3. [邮件功能]

    SMTP=smtp.gmail.com
    smtp_port=587
    sendmail_from = shail.gandhi132@gmail.com
    sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"
    
  4. C:\ XAMPP \ sendmail的

    [sendmail的]

    smtp_server=smtp.gmail.com
    smtp_port=587
    error_logfile=error.log
    debug_logfile=debug.log
    auth_username=shail.gandhi132@gmail.com
    auth_password=(My passowd)
    force_sender=shail.gandhi132@gmail.com
    
  5. 我的PHP代码是

     $to = 'sgandhi132@gmail.com';
     $subject = 'This is subject';
     $message = 'This is HTML message';
     $header ='From:shail.gandhi132@gmail.com';
     $send = mail($to,$subject,$message,$header);
    
     if($send == true) 
     {echo "Mail Sent";}
     else 
     { echo "Error";}
    

0 个答案:

没有答案