gpt4 book ai didi

php - 无法使用 POP3 通过 PHP 发送电子邮件

转载 作者:行者123 更新时间:2023-12-02 17:44:48 25 4
gpt4 key购买 nike

我已经完成编写 PHP 代码以便使用 POP3 发送电子邮件。但是每次我遇到错误

[error] => Connecting to the POP3 server raised a PHP warning: [errno] => 2 [errstr] => fsockopen() [function.fsockopen]: unable to connect to pop3.yahoo.com:465 (A connection attempt failed ) SMTP -> ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time,

这是我的代码。

<?php
require_once('/class.phpmailer.php');
require_once('/class.pop3.php'); // required for POP before SMTP

$pop = new POP3();
$pop->Authorise('pop3.yahoo.com',465,10, 'arsalansherwani@yahoo.com',
'******',1);

$mail = new PHPMailer();
$msg='Name';
//$body = file_get_contents('contents.html');
//$body = eregi_replace("[\]",'',$body);
$address='arsalanjawed619.com';
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->Host = 'pop3.yahoo.com';

$mail->SetFrom('arsalansherwani@yahoo.com', 'arsalan');

$mail->AddReplyTo("arsalansherwani@yahoo.com","arsalan");

$mail->Subject = "PHPMailer Test Subject via POP before SMTP, basic";

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";

$mail->MsgHTML($msg);

$address = "arsalanjawed619@yahoo.com";
$mail->AddAddress($address, "arsalan");

//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment


if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>

任何帮助将不胜感激

最佳答案

您不使用 pop3 发送电子邮件,这是为了检索它们。例如,您使用 SMTP 发送电子邮件...

关于php - 无法使用 POP3 通过 PHP 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16336330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com