Escapeshellcmd() has been disabled for security reason in phpmailer

For PhpMail I Use PHPMailer But it’s not working

Warning : escapeshellcmd() has been disabled for security reasons in /home/vol9_5/epizy.com/epiz_23557515/htdocs/assets/extra/Mail System/PHPMailer-5.2-stable/class.phpmailer.php on line 1447

MyCode :-
<?php

date_default_timezone_set(‘Etc/UTC’);

// Edit this path if PHPMailer is in a different location.

require ‘PHPMailer-5.2-stable/PHPMailerAutoload.php’;

$mail = new PHPMailer;

//$mail->isSMTP();

/*

  • Server Configuration

*/

$mail->Host = ‘smtp.gmail.com’; // Which SMTP server to use.

$mail->Port = 587; // Which port to use, 587 is the default port for TLS security.

$mail->SMTPSecure = ‘tls’; // Which security method to use. TLS is most secure.

$mail->SMTPAuth = true; // Whether you need to login. This is almost always required.

$mail->Username = “*******”; // Your Gmail address.

$mail->Password = “*******”; // Your Gmail login password or App Specific Password.

/*

  • Message Configuration

*/

$mail->setFrom(‘???@gmail.com’, ‘Name Website’); // Set the sender of the message.

$mail->addAddress(‘???@gmail.com’, ‘Name Name’); // Set the recipient of the message.

$mail->Subject = ‘PHPMailer GMail SMTP test’; // The subject of the message.

/*

  • Message Content - Choose simple text or HTML email

*/

// Choose to send either a simple text email…

$mail->Body = ‘This is a plain-text message body’; // Set a plain text body.

// … or send an email with HTML.

//$mail->msgHTML(file_get_contents(‘contents.html’));

// Optional when using HTML: Set an alternative plain text message for email clients who prefer that.

//$mail->AltBody = ‘This is a plain-text message body’;

// Optional: attach a file

$mail->addAttachment(‘images/phpmailer_mini.png’);

if ($mail->send()) {

echo “Your message was sent successfully!”;

} else {

echo "Mailer Error: " . $mail->ErrorInfo;

}

In your custom configuration, I see this line:

//$mail->isSMTP();

The double slashes before the statement mean the code is commented out, and is not run. This makes PHPmailer not use SMTP.

If you remove the slashes from that line, it should remove this error and make PHPmailer try to use SMTP. It may not fix the script right away, but it should get you closer.

after removing double slashes it’s give that type of error

Mailer Error: SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub

please answer me as soon as possible

The SMTP host with the STARTTLS method should be tls://smtp.gmail.com.
Enable Less Secure Apps, then unlock the account here. Then on username insert your Google ID (that’s the Gmail mail) and on password insert the password that you use for login on the Google ID.

Did you try following the instructions on the linked page?

As far as I know, the “Host” field is only the literal host, not a URL with protocol. So the hostname is smtp.gmail.com, and the security protocol is set through the SMTPSecure option.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.