簡體   English   中英

如何配置ini文件用PHP發送郵件

[英]How to configure ini file to send mail with php

我正在使用wampp服務器,我嘗試用PHP腳本發送郵件。 但我收到了錯誤。

我以不同的方式配置了php.ini文件,而wamp服務器沒有sendmail文件。

那么如何設置呢?

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost


; http://php.net/smtp-port
smtp_port = 25

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

   <?php


    $from = "myMail1@gmail.com";
    $to = "test_one@outlook.com";
    $subject = "Checking PHP mail";
    $message = "PHP mail works just fine";
    $headers = "From:" . $from;
    mail($to,$subject,$message, $headers);


?>

警告:mail():無法連接到“localhost”端口25的郵件服務器,驗證php.ini中的“SMTP”和“smtp_port”設置或使用C:\\ wamp64 \\ www \\ sendMail \\ index.php中的ini_set()在第9行

我想消除這個錯誤。 我重啟了我的服務器幾次。

您正在嘗試使用自己的服務器作為smpt服務器(是嗎?)嘗試使用smtp.gmail.com通過端口587

https://support.google.com/a/answer/176600

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM