简体   繁体   English

XAMPP和mailtodisk调试与PHPMailer的电子邮件

[英]Xampp and mailtodisk to debug email message with PHPMailer

I'm trying to create a particular contact form and send all the information using PHPMailer. 我正在尝试创建一个特定的联系表单,并使用PHPMailer发送所有信息。

I want to test every single part before deploing the form, so I was setting up Xampp for linux following this answer 我想在展开表单之前测试每个部分,因此我按照以下答案为Linux设置了Xampp

Use of mailtodisk / mailoutput in XAMPP for Linux 在Linux的XAMPP中使用mailtodisk / mailoutput

and setting my sendmail.php file with placeholders 并使用占位符设置我的sendmail.php文件

$smtpHost = 'localhost';
$smtpUsername = 'hello@example.com';
$smtpPassword = 'PASSWORD';

But it looks like I'm missing some points, if I try to send a mail with this configuration I get 但似乎我遗漏了一些要点,如果我尝试使用这种配置发送邮件,

Failed to connect to server: php_network_getaddresses:

So I tried with the smtpHost of my server and a real username (only the password was fake), and I get the error login message, so I'm really trying to connect to my server, when I tought that it wasn't possible because I never configured Xampp to do that. 因此,我尝试使用服务器的smtpHost和真实的用户名(只有密码是假的),并且收到错误登录消息,所以我真的尝试连接到我的服务器,但我无法保证这是不可能的。因为我从未配置Xampp来做到这一点。

How can I set up Xampp to not send email to external server but only on localhost and write the email in the mailoutput folder? 如何将Xampp设置为不向外部服务器发送电子邮件,而仅在本地主机上发送电子邮件,并将电子邮件写入mailoutput文件夹?

I even tried with Xampp (3.2.2) for windows because I have read that is alredy set to write mail on the mailoutput folder. 我什至尝试使用Windows的Xampp(3.2.2),因为我已经读过将其设置为在mailoutput文件夹上写邮件的信息。

I followed the configuration steps for the php.ini file and for sendmail.ini file. 我遵循了php.ini文件和sendmail.ini文件的配置步骤。 But in the end I had to start mercury to send the mail, now I see the client output of PHPMailer, but even with that the email is not in the mailoutput folder. 但是最后,我不得不启动汞来发送邮件,现在我看到了PHPMailer的客户端输出,但是即使该电子邮件不在mailoutput文件夹中。

So, on Linux I have to install something like mercury to be able to at least debug with client side messages? 因此,在Linux上,我必须安装诸如汞之类的东西才能至少能够调试客户端消息吗? I'm really confused on what to do next. 我真的对下一步做什么感到困惑。

I tried from scratch with a clean installation of ubuntu 16.04 on VirtualBox, but I couldn't figure out how to find the problem. 我从头开始试着用VirtualBox上干净的Ubuntu安装16.04,但我无法弄清楚如何找到问题。

So I downloaded mailslurper from Adam Presley and resolved the problem in another way. 所以,我下载mailslurper亚当·普雷斯利和以另一种方式解决了这个问题。

If you run MailSlurper with root privileges every mail you send is blocked from mailslurper and you can view it from a browser client. 如果用root权限运行MailSlurper每次发送邮件从mailslurper锁定,您可以从浏览器客户端查看。

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

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