Email using PHPMAILER

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
peter_ia
Posts: 4
Joined: 08 Feb 2020, 16:21

Email using PHPMAILER

Post by peter_ia »

Good morning,

NOTE: Avast Mail Shield caused all sorts of problems. For now I've turned it off and am getting closer.

I downloaded PHPMAILER from github and am using it in a test email that works great.
It's in a subdirectory of a Test folder under htdocs. It works.

But mantis uses on in the vendor folder. Even so, the debug file seems to show it working.
But when I setup my config_inc.php I get the following lines in my debug file but no emails.

Code: Select all

$g_allow_signup	 = OFF;  //allows the users to sign up for a new account
$g_enable_email_notification = ON; //enables the email messages
$g_phpMailer_method = PHPMAILER_METHOD_MAIL;
$g_smtp_host = 'smtpout.secureserver.net';
$g_smtp_connection_mode = 'tls';
$g_smtp_port = 587;
$g_smtp_username = 'xxxx@yyyy.com'; //replace it with your gmail address
$g_smtp_password = 'xxxxx'; //replace it with your gmail password
$g_return_path_email = 'xxxx@yyyy.com'; //this will be your administrator email address
$g_administrator_email = xxxx@yyyy.com; //this will be your administrator email address
$g_webmaster_email = 'xxxx@yyyy.com'; //this will be your administrator email address
$g_email_send_using_cronjob = OFF;
$g_email_receive_own = ON;
$g_from_email = 'xxxx@yyyy.com'; //this will be your administrator email address
$g_from_name = 'Bugtracker';
$g_log_level = LOG_EMAIL | LOG_EMAIL_VERBOSE;
$g_log_destination = 'file:c:\temp\mantisEmail.log';
$g_validate_email = ON;

Debug File

Code: Select all

2020-02-11 10:14 EST MAIL_VERBOSE email_queue_api.php:127 email_queue_add() message 74 queued
2020-02-11 10:14 EST MAIL email_api.php:578 email_send_confirm_hash_url() Password reset for user @U4 sent to xxxx@yyyy.com
2020-02-11 10:14 EST MAIL_VERBOSE email_api.php:2094 email_shutdown_function() Shutdown function called for /mantis/manage_user_reset.php (email processing forced)
2020-02-11 10:14 EST MAIL_VERBOSE email_api.php:1210 email_send_all() Processing e-mail queue (1 messages)
2020-02-11 10:14 EST MAIL_VERBOSE email_api.php:1221 email_send_all() Sending message 74
2020-02-11 10:14 EST MAIL_VERBOSE email_queue_api.php:190 email_queue_delete() message 74 deleted from queue
Test.php file that works

Code: Select all

<?php

require_once('PHPMailer/PHPMailerAutoload.php');

$mail = new PHPMailer;

$mail->SMTPDebug = 3;                               
$mail->isSMTP();            
$mail->Host = "smtpout.secureserver.net";
$mail->SMTPAuth = true;                          
$mail->Username = "xxxx@yyyy.com";                 
$mail->Password = "xxxxxx";                           
$mail->SMTPSecure = "tls";                           
$mail->Port = 587;                                   
$mail->From = "xxxx@yyyy.com";
$mail->FromName = "BugTracker";
$mail->addAddress("xxxx@yyyy.com", "Peter");

$mail->isHTML(true);

$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail from test3.php</i>";
$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send()) 
{
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
    echo "Message has been sent successfully";
}
peter_ia
Posts: 4
Joined: 08 Feb 2020, 16:21

Re: Email using PHPMAILER

Post by peter_ia »

Solved (at least for me)

1. Turn off Avast Mail Shield - BTW, it never reported it was blocking the outbound emails.
2. Use SMTP

Whew :D
Post Reply