Codoforum related discussions
Email Configuration Bug?

I'm setting up CF for the first time and trying to get the SMTP email to work with my setup. For several reasons my emailer is a Windows box on the local LAN. It uses self-signed certs which may or may not be part of the problem here, but I want to do a non-SSL connection (because it's local I'm not worried about security) but port 465 is assumed SSL by my server. When connecting to 465 it times out, and my server reports SSL direct-connect failure.

When I change the port to either of the valid non-SSL ports on my server (25 or 125) the forum crashes hard upon save, complaining about incorrect strings. No email is sent.

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xC0\x06\xE7\xD4\x9Cc...' for column 'trace' at row 1 in /var/www/forum/sys/CODOF/Log.php:89

Suggestions welcomed.

I'm setting up CF for the first time and trying to get the SMTP email to work with my setup. For several reasons my emailer is a Windows box on the local LAN. It uses self-signed certs which may or may not be part of the problem here, but I want to do a non-SSL connection (because it's local I'm not worried about security) but port 465 is assumed SSL by my server. When connecting to 465 it times out, and my server reports [b]SSL direct-connect failure[/b]. When I change the port to either of the valid non-SSL ports on my server (25 or 125) the forum crashes hard upon save, complaining about incorrect strings. No email is sent. ```` Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xC0\x06\xE7\xD4\x9Cc...' for column 'trace' at row 1 in /var/www/forum/sys/CODOF/Log.php:89 ```` Suggestions welcomed.

So I'm digging into the code and what seems to be happening is a general failure to send the email no matter what I try. I had a look at the code in /sys/CODOF/Forum/Notification/Mail.php and threw in an echo so I could see the error:

ERROR: SMTP connect() failed.

That's immediately followed by a stack of errors, the first of which I indicated above. I suspect if I can make it actually connect and send the mail that this logging problem will sort itself.

Changing the SMTP Protocol to none didn't fix it, as soon as CF connects to the server it still tries to STARTTLS where all my other websites, also using PHPmailer, start off with user authentication:

AUTH LOGIN

Fixed it!

I had to add the two lines that disabled SMTPAutoTLS and SMTPSecure for PHPmailer. Since these probably only need to be disabled when the protocol is 'none' I did it thusly:

        if (\CODOF\Util::get_opt('smtp_protocol') != 'none') {
            $mail->SMTPAuth = true;  // authentication enabled
            $mail->SMTPSecure = \CODOF\Util::get_opt('smtp_protocol'); // SSL TLS secure transfer enabled REQUIRED for Gmail
        } else {
          $mail->SMTPSecure = false;
          $mail->SMTPAutoTLS = false;
        }

This fix moves the SMTPSecure line up from where it is now, into the first result of this IF, and adds the two new lines to the ELSE.

As far as I know this is all fine and good code, but ¯\_(ツ)_/¯
This doesn't solve the logging problem but I leave that to the experts to figure out.

So I'm digging into the code and what seems to be happening is a general failure to send the email no matter what I try. I had a look at the code in [b]/sys/CODOF/Forum/Notification/Mail.php[/b] and threw in an echo so I could see the error: ```` ERROR: SMTP connect() failed. ```` That's immediately followed by a stack of errors, the first of which I indicated above. I suspect if I can make it actually connect and send the mail that this logging problem will sort itself. Changing the **SMTP Protocol** to **none** didn't fix it, as soon as CF connects to the server it still tries to **STARTTLS** where all my other websites, also using PHPmailer, start off with user authentication: ```` AUTH LOGIN ```` [b]Fixed it![/b] I had to add the two lines that disabled SMTPAutoTLS and SMTPSecure for PHPmailer. Since these probably only need to be disabled when the protocol is 'none' I did it thusly: ```` if (\CODOF\Util::get_opt('smtp_protocol') != 'none') { $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = \CODOF\Util::get_opt('smtp_protocol'); // SSL TLS secure transfer enabled REQUIRED for Gmail } else { $mail->SMTPSecure = false; $mail->SMTPAutoTLS = false; } ```` This fix moves the SMTPSecure line up from where it is now, into the first result of this IF, and adds the two new lines to the ELSE. As far as I know this is all fine and good code, but ¯\\\_(ツ)_/¯ This doesn't solve the [i]logging[/i] problem but I leave that to the experts to figure out.
edited Sep 6 at 2:20 am

Also I think it would be useful for the mail setup page to indicate that 'none' is an option. It defaults to TLS (I believe?) with no indication of what other options might exist for that field.

Also I think it would be useful for the mail setup page to indicate that 'none' is an option. It defaults to TLS (I believe?) with no indication of what other options might exist for that field.

Hi @NFG

Nice job debugging the issue yourself. Yes, we should provide an option to turn off TLS as well as an option to switch to SSL.

We will do that so you can just set that option in the backend in the next release.

Hi @NFG Nice job debugging the issue yourself. Yes, we should provide an option to turn off TLS as well as an option to switch to SSL. We will do that so you can just set that option in the backend in the next release.
Necessity is the mother of all inventions!
45
3
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft