简体   繁体   English

如何在没有 SMTP 的情况下从 PHPMAILER 发送电子邮件

[英]How send email from PHPMAILER without SMTP

Can anyone tell me, how send email from PHPMailer not using SMTP?谁能告诉我,如何使用 SMTP 从PHPMailer发送电子邮件? This class includes the method isMail() and it should send an email using the mail() function instead SMTP.此类包括方法isMail()并且它应该使用mail()函数而不是 SMTP 发送电子邮件。 I'm use Xaamp.我正在使用 Xaamp。 When I use SMTP server it's not working all.当我使用 SMTP 服务器时,它无法正常工作。

My code:我的代码:

$mail=new PHPMailer();
$mail->IsMail();
$mail->From = 'xxxx@email.com';
$body = "Test body message";
$mail->AddAddress("xxxx@emai.com", "John Doe");
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->MsgHTML($body);

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

Send Method returns true and displays message that email has been sent?发送方法返回true并显示电子邮件已发送的消息?

The topic is old but for those who will read this.这个话题很旧,但对于那些会阅读这篇文章的人来说。 Try to replace尝试更换

$mail->isSMTP();

by经过

$mail->isSendMail();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM