0

In VS 2022, I have built a simple html contact form linking to a php file to send an e-mail. There is no error returned by “mail($to,$subject,$message,$headers);” but the mail does not get dispatchted. I have devsense PHP tools installed and the php.ini file is C:\Program Files\IIS Express\PHP\v8.1\php.ini.

Windows 11 pro, 22H2, IIS 10.0.22621

Principally I am confident that the code with input from previous stackoverflow contributions is fine. The code runs successfully on notepad++ with the Apache Xampp server and my google account. In php.ini I have set

smtp_server = smtp.gmail.com
smt_port = 587
sendmail_from = me@example.com
sendmail_path ="\"C:\xampp\sendmail\sendmail.exe\" -t"

Accordingly, I have used these settings also in C:\Program Files\IIS Express\PHP\v8.1\php.ini. This ini file is now diverting to the sendmail.exe in my xampp/sendmail folder, but this seems not be correct for VS 2022. Any idea which settings to be made under VS 2022 and where to get the e-mail function working?

  • Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – ADyson Dec 18 '22 at 18:29
  • P.s. VS 2022 is just an IDE, not a mailserver. It's nothing to do with that software. – ADyson Dec 18 '22 at 18:30
  • The answer mentioned by this community member has been explained in great detail. You can refer to the method of the answer to try to solve your problem. You can also refer to [this](https://mailtrap.io/blog/php-email-sending/#PHP-mail-function-is-not-sending-the-email) for more information. – TengFeiXie Dec 19 '22 at 08:45

0 Answers0