XAMPP - unable to send dummy emails

1.6k views Asked by At

I cannot get XAMPP to send a dummy email from PHP using mailtodisk.exe (in other words, to save the output to the disk instead of really sending the mail). Instead, no matter what I do, the mails keep being sent normally. I am trying to set it to not really send the mails but to generate their output, using the mailtodisk.exe utility that comes with XAMPP.

My php.ini settings seem correct to me (although I do not know whether the sendmail_path needs to be in escaped quotes as the commented sendmail.exe's path is - in any case, I tried both and neither worked):

; sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"

phpinfo() also shows that the settings are correct:

enter image description here

I tried setting the "sendmail_path" variable directly from the source code using ini_set(), I tried altering the "php.ini-production" and "php.ini-development" files as well (although pointlessly if you ask me), I even deleted the whole sendmail.exe containing folder completely, I did restart Apache every time I changed a setting, and it's still sending normal mails. My system is running Windows 10, XAMPP version is 3.2.2 and php version is 5.6.14.

What am I missing here?

EDIT: I neglected to mention that it used to work properly in the beginning, when I first installed XAMPP. Then at some point I needed to send an actual mail, so I changed the php.ini to use sendmail.exe, and I never managed to restore it ever since.

3

There are 3 answers

0
Álvaro González On BEST ANSWER

If you use PHPMailer to send your messages you need to ensure that it isn't using SMTP (if it opens a network connection to a remote server it won't use your local mailer). To do so you need to not call isSMTP() because the default method is to use built-in mail() function:

/**
 * Which method to use to send mail.
 * Options: "mail", "sendmail", or "smtp".
 * @type string
 */
public $Mailer = 'mail';
2
Dakota Wagner On

When I did this for my web server, I ran the mailtodisk.exe, and then in the root XAMPP folder was the mail folder and the emails were all in there.

I didn't have to do any config myself, it just worked.

2
Grzegorz Miśkiewicz On

Maybe try to configure external SMTP server to use it with mail for example using google gmail.