小编Dev*_*ree的帖子

身份验证失败[SMTP:STARTTLS失败(代码:220,响应:2.0.0准备启动TLS)]

我正在尝试使用SMTP和PEAR在PHP中发送带有附件的电子邮件,但收到以下错误消息:“身份验证失败[SMTP:STARTTLS失败(代码:220,响应:2.0.0准备启动TLS)]”

<?php
require_once "Mail.php"; // PEAR Mail package
require_once ('Mail/mime.php'); // PEAR Mail_Mime packge

$from = "Your Mom <sender@gmail.com>";
$to = "Me <recepient address@gmail.com>";
$subject = 'Call Me!';

$headers = array ('From' => $from,'To' => $to, 'Subject' => $subject);

// text and html versions of email.
$text = 'Hi son, what are you doing?nnHeres an picture of a cat for you.';
$html = 'Hi son, what are you doing?<br /><br />Here is an picture of a cat 
for you.';

// …
Run Code Online (Sandbox Code Playgroud)

php email pear smtp

2
推荐指数
2
解决办法
1万
查看次数

标签 统计

email ×1

pear ×1

php ×1

smtp ×1