簡體   English   中英

SMTP 服務器響應:530 5.7.0 必須首先發出 STARTTLS 命令。 Windows 7的

[英]SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. windows 7

好吧,我使用的是 Windows 7,我正在嘗試使用 php 中的 mail() 函數發送電子郵件。 我寫了並嘗試了很多但仍然無法發送。 這是我的代碼:

 ini_set("SMTP","smtp.gmail.com");
ini_set("smtp_port","25");


$to = 'asdf@gmail.com';
$subject = 'hi';
$msg = 'Test';
$headers ='Reply-To: shawn.danisa@gmail.com' . "\r\n" .
        'From: postmaster@localhost' ."\r\n" .
        'X-Mailer: PHP /' . phpversion();
mail($to, $subject,$msg,$headers);

我得到:

  SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. x42sm11770579eel.41 - gsmtp

我嘗試使用端口 587 但后來我得到:

    SMTP server response: 530 5.7.0 Must issue a STARTTLS command first.      y51sm11859758eeu.0 

請幫助端口 465 我的頁面甚至無法加載。 我再次使用 Windows 7。

使用像 Swiftmailer 這樣的庫來為你處理這個問題: http ://swiftmailer.org/docs/sending.html

暫無
暫無

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

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