Quantcast
Channel: ProjeQtOr free project management software - ProjeQtOr free project management software - Recent Topics - ProjeQtOr
Viewing all articles
Browse latest Browse all 6784

Modifications to PHPMailer configuration - by: eabjoker

$
0
0
I am referencing version 6.4.1
I would like to ask if you can add two settings to the Global_Parameters->Mailing configuration.

The first is to allow the Helo line to be configured and the second is to allow turning off the SMTPSecure setting.
Please see code snippet below from projeqtor.php for the modifications I needed to get this working for my mail smtp server. Line 4 is added, line 12 is commented out
$phpmailer = new PHPMailer ();
  ob_start ();
  if ($logLevel>='3') $phpmailer->SMTPDebug=1;
  $phpmailer->Helo = '['.$_SERVER['SERVER_ADDR'].']';
  $phpmailer->isSMTP (); // Set mailer to use SMTP
  $phpmailer->Host = $paramMailSmtpServer; // Specify main smtp server
  $phpmailer->Port = $paramMailSmtpPort;
  if ($paramMailSmtpUsername and $paramMailSmtpPassword) {
    $phpmailer->SMTPAuth = true; // Enable SMTP authentication
    $phpmailer->Username = $paramMailSmtpUsername; // SMTP username
    $phpmailer->Password = $paramMailSmtpPassword; // SMTP password
#    $phpmailer->SMTPSecure = 'tls'; // default (for ports 25 and 587
    if ($paramMailSmtpPort == '465')
      $phpmailer->SMTPSecure = 'ssl'; // 465 is default for ssl
    if (strpos ( $phpmailer->Host, '://' )!==false) {
      $phpmailer->SMTPSecure = substr ( $phpmailer->Host, 0, strpos ( $phpmailer->Host, '://' ) );
      if ($phpmailer->SMTPSecure=="smtp") $phpmailer->SMTPSecure="";
      $phpmailer->Host = substr ( $phpmailer->Host, strpos ( $phpmailer->Host, '://' ) + 3 );
    }
  }

For the Helo line it should default to the hostname, as it does by default in PHPMailer. I needed to use the IP address here.
SMTPSecure should just be a configuration flag, on/off.

Viewing all articles
Browse latest Browse all 6784

Trending Articles