我正在使用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。