Phpmailer: escapeshellcmd() has been disabled for security reasons in class.phpmailer.php on line 1442

Created on 18 Jan 2017  路  14Comments  路  Source: PHPMailer/PHPMailer

Hello,

Due to the recent security fix, I have updated the library to latest stable version. I have also changed the FROM address to normal email instead of $_POST. But the console shows an error:

escapeshellcmd() has been disabled for security reasons in class.phpmailer.php on line 1442

However, The email was successfully sent! So now I'm confused.

Please help.

~Surjith

Most helpful comment

Would you like me to move your mouse for you too? You could perhaps start from the project's front page.

All 14 comments

This is down to your local PHP config, not PHPMailer. Functions can be disabled for any reason, security being a common one. escapeshellcmd has a number of serious potential issues, so it looks like it's been turned off for you, causing this error. You can work around this easily by doing what PHPMailer recommends anyway: sending using SMTP to localhost, not the default mail() transport.

how to avoid this message
Warning: escapeshellcmd() has been disabled for security reasons in /storage/ssd2/771/4867771/public_html/PHPMailer/PHPMailer.php on line 1584

Read the thread, do what I said, since it addresses exactly the problem you describe. Simply add:

$mail->isSMTP();

and PHPMailer will send via SMTP to localhost, which does not involve calling escapeshellcmd.

Fatal error: Uncaught Error: Class 'PHPMailer\PHPMailer\SMTP' not found in

You're not using composer and/or you didn't read the readme where it tells you how to load the classes.

please help solving this....

SMTP ERROR: Password command failed:
SMTP Error: Could not authenticate.

                  $mail->isSMTP(); 
                    $mail->SMTPDebug = 2;  
                    $mail->SMTPAuth = true;                             
                    $mail->SMTPSecure = 'ssl';                                 
                    $mail->Host = 'smtp.gmail.com';
                    $mail->Port = 465;      


                    $mail->Username = '[email protected]';                 
                    $mail->Password = '';                           
                    $mail->setFrom('@gmail.com');   
                    $mail->addAddress($email, $name);
                    $mail->Subject = "Please verify email!";
                    $mail->isHTML(true); 
                    $mail->Body = " Please click on the link below:<br><br> ";

                    $mail->send();

                         $msg = "You have been registered! Please verify your email!";

                      }catch (Exception $e) {
                             $msg = "Something wrong happened! Please try again!";

                 }

Read the rest of the debug output, then read the troubleshooting guide.

it working in local host
when i try to wok in my domain
it showing this error

Warning: escapeshellcmd() has been disabled for security reasons

pls help me with this\
code

$email='[email protected]';
require 'mailer/PHPMailerAutoload.php';
$mail = new PHPMailer;

$mail->Host ='smtp.gmail.com';
$mail->Port =587;
$mail->SMTPAuth=true;
$mail->SMTPSecure='tls';

$mail->Username='[email protected]';
$mail->Password="XXXXXXXX";

$mail->setFrom('[email protected]','YYYYY');
$mail->addAddress($email);
$mail->addReplyTo('[email protected]');

$mail->isHTML(true);
$mail->Subject='XXXXX';
$mail->Body="hai";
if(!$mail->send())
{
echo"no";
}
else
{
echo"yes";
}

?>

Call $mail->isSMTP(); and it will not need to use escapeshellcmd.

i used that ,mail is not sending iam using in my domain

when i used that it show no error bt mail is not sending

So go read the docs, figure out why. There is nothing I can say here that is not in the guide.

where i find the docs???

Would you like me to move your mouse for you too? You could perhaps start from the project's front page.

Was this page helpful?
0 / 5 - 0 ratings