Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XAMPP - unable to send dummy emails

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.

like image 512
pazof Avatar asked Nov 08 '22 13:11

pazof


1 Answers

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';
like image 86
Álvaro González Avatar answered Nov 14 '22 22:11

Álvaro González