Hello,
I've been trying to use phpMailer to send me an email when someone adds a comment.
I've done the following:
But this is not working as expected, it does add the comment and it does echo the success message but it doesn't send the email
I've been trying to use phpMailer to send me an email when someone adds a comment.
I've done the following:
- Code: Select all
<cms:if k_is_commentable >
<div class="comment-form" >
<cms:form method="post" class="k_form">
<cms:if k_success >
<cms:process_comment />
<cms:if k_process_comment_success>
<cms:php>
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
<cms:pages masterpage="contact.php">
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = '<cms:show my_host />'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '<cms:show my_email />'; // SMTP username
$mail->Password = '<cms:show my_password />'; // SMTP password
$mail-> SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = <cms:show my_port />; // TCP port to connect to
$mail->addAddress('<cms:show my_email />', '<cms:show my_email_name />'); // Add a recipient
</cms:pages>
$mail->addReplyTo('<cms:show k_comment_author_email />', '<cms:show k_comment_author />');
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->From = '<cms:show k_comment_author_email />';
$mail->FromName = '<cms:show frm_name />';
$mail->Subject = 'Un mesaj de la <cms:show k_comment_author />';
$mail->Body = '
You have a new comment from <cms:show k_comment_author /> on <cms:show k_page_title/><br /><br />
<cms:show k_comment />
';
</cms:php>
<div class="k_successmessage">
...
But this is not working as expected, it does add the comment and it does echo the success message but it doesn't send the email
