0

While this works just fine, I am concerned that it poses a security threat. Does it?

add_action( 'phpmailer_init', 'send_email_using_smtp' );
function bsend_email_using_smtp( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = 'mail.example.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 465;
$phpmailer->Username = '[email protected]';
$phpmailer->Password = 'your-email-account-password';
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->From = 'name@example.com';
$phpmailer->FromName = 'Your company name';
}
4
  • What security threat are you concerned about? This action is used to setup a smtp, nothing else. Jan 13, 2022 at 7:13
  • That someone, somehow, can get a hold of the SMTP credentials and use them. Or am I just "afraid" for nothing? Jan 13, 2022 at 7:18
  • 1
    Unless they have administrator access this info would not be visible, direct access to the file is not allowed because of defined('ABSPATH') || exit;, if you have it, even if you don't this would not be visible. You could use something like bedrock which allows you to create environments and credentials before the root folder (as it changes it), that way nobody could every target those folders directly. Jan 13, 2022 at 7:24
  • Awesome. Thanks :) Jan 13, 2022 at 7:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.