简体   繁体   中英

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.

I want to test every single part before deploing the form, so I was setting up Xampp for linux following this answer

Use of mailtodisk / mailoutput in XAMPP for Linux

and setting my sendmail.php file with placeholders

$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.

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?

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.

I followed the configuration steps for the php.ini file and for sendmail.ini file. 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.

So, on Linux I have to install something like mercury to be able to at least debug with client side messages? 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.

So I downloaded mailslurper from Adam Presley and resolved the problem in another way.

If you run MailSlurper with root privileges every mail you send is blocked from mailslurper and you can view it from a browser client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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