Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling VPN by Google One causes a 'sendWithSmtp throwed ErrorException' #8207

Open
bananacoffee opened this issue Nov 14, 2023 · 1 comment
Labels
waiting for info Issues or pull requests that need further clarification from the author

Comments

@bananacoffee
Copy link

bananacoffee commented Nov 14, 2023

PHP Version

8.2

CodeIgniter4 Version

4.4.3

CodeIgniter4 Installation Method

Composer (as dependency to an existing project)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MariaDB 10.4.28

What happened?

When attempting to send SMTP emails with VPN by Google One enabled, an error occurred.

Steps to Reproduce

  1. VPN by Google One enabled (Apache Server Exists)
  2. Send SMTP Mail using Email Class

Expected Output

Error

ERROR - 2023-11-14 11:39:35 --> Email: sendWithSmtp throwed ErrorException: Uninitialized string offset 3 in D:\xampp\htdocs\test\vendor\codeigniter4\framework\system\Email\Email.php:2106
Stack trace:
#0 D:\xampp\htdocs\test\vendor\codeigniter4\framework\system\Email\Email.php(2106): CodeIgniter\Debug\Exceptions->errorHandler(2, 'Uninitialized s...', 'D:\\xampp\\htdocs...', 2106)
#1 D:\xampp\htdocs\test\vendor\codeigniter4\framework\system\Email\Email.php(1982): CodeIgniter\Email\Email->getSMTPData()
#2 D:\xampp\htdocs\test\vendor\codeigniter4\framework\system\Email\Email.php(2209): CodeIgniter\Email\Email->sendCommand('quit')
#3 [internal function]: CodeIgniter\Email\Email->__destruct()
#4 {main}

printDebugger

hello: 220 sv10703.xserver.jp ESMTP Postfix
The following SMTP error was encountered: 220 sv1234567.xserver.jp ESMTP Postfix
starttls: 250-sv1234567.xserver.jp
250-PIPELINING
250-SIZE 102400000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

The following SMTP error was encountered: 250-sv1234567.xserver.jp
250-PIPELINING
250-SIZE 102400000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

Unable to send email using SMTP. Your server might not be configured to send mail using this method.

Anything else?

Fixing it to not break on "250 DSN" allowed the email to be sent successfully.

vendor\codeigniter4\framework\system\Email\Email.php
-            if ($str[3] === ' ') {
+            if ($str[3] === ' ' && substr($str, 0, 3) !== '250') {
                break;
            }

printDebugger

hello: 220 sv1234567.xserver.jp ESMTP Postfix
The following SMTP error was encountered: 220 sv1234567.xserver.jp ESMTP Postfix
starttls: 250-sv1234567.xserver.jp
250-PIPELINING
250-SIZE 102400000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
220 2.0.0 Ready to start TLS

The following SMTP error was encountered: 250-sv1234567.xserver.jp
250-PIPELINING
250-SIZE 102400000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
220 2.0.0 Ready to start TLS

hello: 250-sv1234567.xserver.jp
250-PIPELINING
250-SIZE 102400000
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

from: 250 2.1.0 Ok
to: 250 2.1.5 Ok
data: 354 End data with <CR><LF>.<CR><LF>
250 2.0.0 Ok: queued as 848D3D02397B63
quit: 221 2.0.0 Bye
@bananacoffee bananacoffee added the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 14, 2023
@kenjis
Copy link
Member

kenjis commented Nov 14, 2023

Thank you for reporting.

But I don't understand why the error occurs.

Uninitialized string offset 3 in D:\xampp\htdocs\test\vendor\codeigniter4\framework\system\Email\Email.php:2106

I'm not sure about the debug logs either.
What is "The following SMTP error" ?
Can you elaborate?

@kenjis kenjis added the waiting for info Issues or pull requests that need further clarification from the author label Nov 20, 2023
@paulbalandan paulbalandan removed the bug Verified issues on the current code behavior or pull requests that will fix them label Nov 28, 2023
@paulbalandan paulbalandan changed the title Bug: Enabling VPN by Google One causes a 'sendWithSmtp throwed ErrorException' Enabling VPN by Google One causes a 'sendWithSmtp throwed ErrorException' Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for info Issues or pull requests that need further clarification from the author
Projects
None yet
Development

No branches or pull requests

3 participants