I used this code in my child theme(child theme functions.php):
add_action( 'phpmailer_init', 'wpse8170_phpmailer_init',0 );
function wpse8170_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->Host = 'your.smtp.server.here';
$phpmailer->Port = 25; // could be different
$phpmailer->Username = 'your_username@example.com'; // if required
$phpmailer->Password = 'yourpassword'; // if required
$phpmailer->SMTPAuth = true; // if required
$phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value
$phpmailer->IsSMTP();
}
But it doesn't send SMTP mail. I checked the SMTP credentials with SMTP programs(like wp mail SMTP) and they send test email successfully but when I use Contact form 7 plugin it doesn't send mail anymore. My host is cPanel/ GoDady
Could anyone help me?