sendmail.exe" -t' is not recognized as an internal or external command

2.3k Views Asked by At

Having some issues with Sendmail on Xampp (Windows Installation) - When I try a test Email (See below script)

<?php 
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "[email protected]";
$to = "[email protected]";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
echo "Test email sent";
?>

Upon running this script and checking the error.log I get the following error:

'D:\Xampp2\sendmail\sendmail.exe" -t' is not recognized as an internal or external command,
operable program or batch file.

My settings look like so:

PHP.ini

XAMPP: Comment out this if you want to work with an SMTP Server like    Mercury
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_from = [email protected]
sendmail_path="D:\xampp2\sendmail\sendmail.exe\" -t"

Sendmail.ini

smtp_server= smtp.gmail.com
smtp_port= 465
smtp_ssl= auto
[email protected]
auth_password=(HIDDEN)

I have tried using ports of: 587, 465, 25 for the smtp_port area. Rather stumped on this one - any ideas please? :)

1

There are 1 best solutions below

1
On

OK! So I have worked this out myself by commenting out:

sendmail_path="D:\xampp2\sendmail\sendmail.exe\" -t"

However, I now got an Email from Google saying:

We recently blocked a sign-in attempt to your Google Account 

So the emails are getting through. I worry that this may impact on other recipients receiving the same issue?

EDIT: Getting an error on the running of the above script, the error is:

Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. q2sm18977843wjz.15 - gsmtp in D:\xampp2\htdocs\test-email.php on line 9