Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

Modifications to PH...
 
Notifications
Clear all

Modifications to PHPMailer configuration

5 Posts
2 Users
0 Reactions
5,228 Views
(@eabjoker)
Posts: 11
Active Member
Topic starter
 
[#4747]

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.


 
Posted : 02 Nov 2017 9H38
babynus
(@babynus)
Posts: 14954
Main Contributor Admin
 

Hi,
I don't understand why you had to configure the Helo :huh:
To change mode, just specify it in host name parameter : ssl://hostname or tls://hostname or smtp://hostname


 
Posted : 02 Nov 2017 10H50
(@eabjoker)
Posts: 11
Active Member
Topic starter
 

I will try smtp://hostname. I was not aware that this would have the same effect.
The Helo line allows the use of a godaddy workspace email account to send email. Godaddy has some rules setup to block outside smtp relay, even if you have valid email account credentials. Setting the client server Helo line as I have here gets around this and allows the connection. The default Helo line provided by PHPMailer is set to serverHostname(), which in my case is not correct, and godaddy rejects the connection. So a way to provide 'Server Hostname' manually is what would be needed.


 
Posted : 02 Nov 2017 21H04
(@eabjoker)
Posts: 11
Active Member
Topic starter
 

Here is a little more info...
Your HELO/EHLO name should be the system's fully-qualified domain name.
RFC2821
These commands are used to identify the SMTP client to the SMTP server. The argument field contains the fully-qualified domain name of the SMTP client if one is available. In situations in which the SMTP client system does not have a meaningful domain name (e.g., when its address is dynamically allocated and no reverse mapping record is available), the client SHOULD send an address literal (see section 4.1.3), optionally followed by information that will help to identify the client system. The SMTP server identifies itself to the SMTP client in the connection greeting reply and in the response to this command.
(the "address literal" is the address in brackets ([192.0.2.1]), or for v6 the address with an IPv6 prefix ([IPv6:fe80::1]))


 
Posted : 02 Nov 2017 21H12
(@eabjoker)
Posts: 11
Active Member
Topic starter
 

Follow up, using smtp://hostname seems to have addressed this problem.


 
Posted : 10 Nov 2017 0H13
Share:

Scroll to Top