0

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.

AskaNor_29
  • 97
  • 1
  • 12
  • If you are trying to send email using smtp then you should use an smtp server like smtp.gmail.com and as user name and password you shold provide your gmail user name and gmail password – yaxe Feb 15 '18 at 12:57
  • @yaxe I am using smtp, but I don't want to connect to any external server, I want to test everithing on my machine. – AskaNor_29 Feb 15 '18 at 13:12
  • have you installed smtp server on localhost? – yaxe Feb 15 '18 at 13:43
  • Yes, I have installed sendmail on linux, but I don't understand why,even on windows that isn't enough, I had to start mercury to send the mail. – AskaNor_29 Feb 15 '18 at 15:22

1 Answers1

0

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.

AskaNor_29
  • 97
  • 1
  • 12