尝试在localhost问题上发送电子邮件(SMTP错误:无法进行身份验证。) [英] trying to sent emails on localhost issue (SMTP Error: Could not authenticate.)
本文介绍了尝试在localhost问题上发送电子邮件(SMTP错误:无法进行身份验证。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在localhost上测试我的电子邮件,我收到此错误: SMTP错误:无法进行身份验证。
有人知道如何发送localhost上的电子邮件?可以看看我做错了吗?因为我猜一切都是正确的,我不明白发生了什么错误。
我在我的xampp文件夹中的php.ini中进行了这个配置:< br $> b $ b
mail function]
; XAMPP: 评论 out 此 如果 你 想要 work with a SMTP 服务器 喜欢 Mercury
; SMTP = < span class =code-leadattribute> localhost
smtp_port = 25
; For Win32 仅。
; http: // php.net/sendmail-from
sendmail_from = myemail @ hotmail。 com
我正在使用php邮件程序类发送电子邮件:
< ?php
define(' MAILUSER',' myemail@hotmail.com');
define(' MAILPASS',' ');
define(' MAILPORT',' 587');
define(' MAILHOST',' smtp.live.com');
define(' SITENAME',' 站点名称');
函数sendMail($ subject,$ message,$ sender,$ senderName,$ destination,$ destinationName,$ reply = NULL,$ replyNome = NULL){
require_once( ' mail / class.phpmailer.php');
$ mail = new PHPMailer();
$ mail-> IsSMTP();
$ mail-> SMTPAuth = true ;
$ mail-> IsHTML( true );
$ mail-> Host = MAILHOST;
$ mail-> Port = MAILPORT;
$ mail->用户名= MAILUSER;
$ mail->密码= MAILPASS;
$ mail-> From = utf8_decode($ sender);
$ mail-> FromName = utf8_decode($ senderName);
if ($ reply!= NULL){
$ mail-> AddReplyTo(utf8_decode($ reply),utf8_decode( $ replyNome));
}
$ mail-> Subject = utf8_decode($ assunto);
$ mail-> Body = utf8_decode($ mensagem);
$ mail-> AddAddress(utf8_decode($ destination),utf8_decode($ destinationName));
if ($ mail-> Send()){
return true ;
} 其他 {
return 假跨度>;
}
}
?>
解决方案
受试者
消息
发件人,
I´m trying to test my emails on localhost, and I´m getting this error: SMTP Error: Could not authenticate.
Somebody there know how to send emails on localhost? Can see if I´m doing something wrong? Because I guess everything is correct and I´m not understanding what is happening to have this error.
I did this configuration in php.ini ony my xampp folder:
mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = localhost
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = myemail@hotmail.com
Im using php mailer class to send the email:
<?php
define('MAILUSER','myemail@hotmail.com');
define('MAILPASS','');
define('MAILPORT','587');
define('MAILHOST','smtp.live.com');
define('SITENAME', 'Site Name');
function sendMail($subject,$message,$sender,$senderName,$destination,$destinationName, $reply = NULL, $replyNome = NULL){
require_once('mail/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->IsHTML(true);
$mail->Host = MAILHOST;
$mail->Port = MAILPORT;
$mail->Username = MAILUSER;
$mail->Password = MAILPASS;
$mail->From = utf8_decode($sender);
$mail->FromName = utf8_decode($senderName);
if($reply != NULL){
$mail->AddReplyTo(utf8_decode($reply),utf8_decode($replyNome));
}
$mail->Subject = utf8_decode($assunto);
$mail->Body = utf8_decode($mensagem);
$mail->AddAddress(utf8_decode($destination),utf8_decode($destinationName));
if($mail->Send()){
return true;
}else{
return false;
}
}
?>
解决方案
subject,
message,
sender,
这篇关于尝试在localhost问题上发送电子邮件(SMTP错误:无法进行身份验证。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文