SMTP mail stopped working after upgrade to 2022.1

Posted on
Tue Jun 21, 2022 8:58 am
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Turn on detailed debugging and see if that gives us more info.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jun 21, 2022 9:00 am
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

I just had one other thought. Are you editing the password field "on the fly"? You said you're using some sort of secure token. How does that work? What's your exact process?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jun 21, 2022 12:44 pm
anyone offline
Posts: 67
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: SMTP mail stopped working after upgrade to 2022.1

The configuration is staying the same, I am not making any changes to the credentials. Also, when I downgrade, w/o any changes, I can immediately send emails.

You said you're using some sort of secure token. How does that work? What's your exact process?


My Yahoo! username and password was what I used as credentials with Indigo "forever". Then it suddenly stopped working (~2 years ago, 5/15/2020 to be exact) and after researching it, I discovered that I needed to create a separate password, to be used with applications that did not use OAuth. That password is referred to as a secure mail key and it can only be used to send/receive emails, I believe.

I did just try using my Yahoo! password and as expected, it appears to be immediately rejected.

Code: Select all
Email+ Error                    Email+ SMTP Server: SMTP server connection error: Connection unexpectedly closed


This link https://www.att.com/support/article/email-support/KM1240462 points to a FAQ about the security update.

FYI: I previously lifted parts of my code, sticking it in your plugin and was able to get the Plugin to send emails w/o the error, using a variation of

Code: Select all
connection.sendmail(....)
instead of
Code: Select all
connection.send_message(msg)


This was a crude attempt to figure out if it was something on my side. I could get the dropped in code to send but couldn't sort thru, nor was I really worried about BCC, CC, Subject, attachments, etc. What this did do though, in my mind, was validate usable credentials are being passed and could be used by the Plugin.

What syntax would you use for connection.sendmail(...) in this Plugin? By changing just that one line of code in the Plugin, a email is sent but arrives but without the text, subject, etc. Presumably because I'm not using the correct syntax.

Detailed debugging is on but it is not capturing the root cause of the problem.

Code: Select all
Jun 21, 2022 at 10:38:07 AM
   Upgrading plugin Email+ to newer version 2022.1.1 (previous version moved to trash)
   Loading plugin "Email+ 2022.1.1" using API v3.0
   Starting plugin "Email+ 2022.1.1" (pid 15833)
   Started plugin "Email+ 2022.1.1"
   Email+ Debug                    Email+ SMTP Server: Starting device (smtpAccount)
   Email+ Debug                    Email+ SMTP Server: SMTP poll, 0 items in queue
   Action Group                    send a test email - with python
   Email+ Debug                    sendEmailAction queueing message 'Email+ 2021.1.1'
   Email+ Debug                    Email+ SMTP Server: SMTP poll, 1 items in queue
   Email+                          sending email 'Email+ 2021.1.1' to 'XXXXX@yahoo.com' using Email+ SMTP Server
   Email+ Debug                    Email+ SMTP Server: sending:
From: XXXXX@sbcglobal.net
Subject: Email+ 2021.1.1
To: XXXXX@yahoo.com
Cc:
Bcc:
Date: Tue, 21 Jun 2022 10:38:50 -0400
Message-ID: <165582233063.15833.473244581946264819@1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0

If you get this...this is your workaround

   Email+ Error                    Email+ SMTP Server: SMTP server connection error: (554, b'6.6.0 Error sending message for delivery.')
   Email+ Debug                    connErrorTriggerCheck: Checking Triggers for Device Email+ SMTP Server (1059244909)


Posted on
Tue Jun 21, 2022 1:00 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Hmm. The description made me think your "secure mail key" was some sort of OTP from an authenticator. But it's really an app-specific password, which is pretty common these days. So much for that idea.

send_message() is just a convenience wrapper for sendmail() which uses a Message object instead of individual parameters for the to/from/subject/etc. See https://docs.python.org/3/library/smtplib.html. So they only way that would effect things is if there's something untoward in the message object that's not in your sample code, and which you didn't specify when you changed the plugin code.

Can you post a screenshot of the action dialog for the email you're sending? The one that shows the subject and message blocks? I'm wondering if there's something in there that's causing the issue.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jun 21, 2022 1:39 pm
anyone offline
Posts: 67
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: SMTP mail stopped working after upgrade to 2022.1

Screenshots of two different Action Groups that I have used for testing. Both result in the same error.
Attachments
Untitled 34.jpg
Untitled 34.jpg (238.94 KiB) Viewed 172 times
Untitled 35.jpg
Untitled 35.jpg (175.22 KiB) Viewed 172 times
Untitled 36.jpg
Untitled 36.jpg (135.27 KiB) Viewed 172 times

Posted on
Tue Jun 21, 2022 2:59 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

We're grasping at straws here, but can you try re-generating your "mail key" and trying the new one?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jun 21, 2022 3:19 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Also, try this version: https://drive.google.com/file/d/1-1nuW3 ... sp=sharing

You'll have to move it to the plugins folder manually, as it as the same version number as the previous test version.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jun 21, 2022 6:09 pm
anyone offline
Posts: 67
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: SMTP mail stopped working after upgrade to 2022.1

We're grasping at straws here, but can you try re-generating your "mail key" and trying the new one?


A new secure key was created and when used with the 2022 versions, the same error is seen. When used with 2021.1.1 it works fine.

FlyingDiver wrote:
Also, try this version: https://drive.google.com/file/d/1-1nuW3 ... sp=sharing

You'll have to move it to the plugins folder manually, as it as the same version number as the previous test version.


Same error when using this version.

I did try something, if I make the following modifications, to SMTPServer.py, I can send emails without any errors.

Change From:

Code: Select all
            # connection complete, send the message
            # connection.send_message(msg)
            connection.sendmail(msg['From'], all_addresses, msg.as_string())
            connection.quit()           


Change to:


Code: Select all

            # connection complete, send the message
            # connection.send_message(msg)

            the_email = "From: {0}\nTo: {1}\nSubject: {2}\nDate: {3}\n\n{4}".format(msg['From'],
                                                                                    msg['To'],
                                                                                    msg['Subject'],
                                                                                    msg['Date'],
                                                                                    emailMessage)
            connection.sendmail(msg['From'], all_addresses, the_email)
            connection.quit()


It seems the issue occurs when msg is processed. Since I'm the only one complaining...it could be something the servers I'm using think is formatted incorrectly or is missing.

What exactly that is....I'm still unsure of.

Posted on
Tue Jun 21, 2022 8:19 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Go back to my last code, and comment out this line:

Code: Select all
        msg['Message-ID'] = make_msgid()

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 22, 2022 3:50 am
anyone offline
Posts: 67
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: SMTP mail stopped working after upgrade to 2022.1

FlyingDiver wrote:
Go back to my last code, and comment out this line:

Code: Select all
        msg['Message-ID'] = make_msgid()


When commenting out the above line from the previously shared code, I still see the same error.

Although, if comment out the "Cc" and "Bcc" lines in the code, I am able to send emails with no errors. If I leave the "Cc" line in the code and include a "Cc" when sending an email, it also works. So its appears to be something about those two (2) fields when they have no value.

Using the below code...appears to address the issue by simply not including a "Cc" or "Bcc" in msg when they have no value.

Code: Select all
msg['To'] = ",".join(to_addresses)
msg['Cc'] = ",".join(cc_addresses)
msg['Bcc'] = ",".join(bcc_addresses)
msg['Date'] = formatdate(localtime=True)
msg['Message-ID'] = make_msgid()
if len(msg['Cc']) == 0: del msg['Cc']
if len(msg['Bcc']) == 0: del msg['Bcc']

Posted on
Wed Jun 22, 2022 5:20 am
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Interesting. Let me look into that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 22, 2022 6:15 am
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1


joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jun 23, 2022 12:22 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Have you had a chance to test the version I posted yesterday?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jun 23, 2022 5:34 pm
anyone offline
Posts: 67
Joined: Apr 03, 2011
Location: Norfolk, VA

Re: SMTP mail stopped working after upgrade to 2022.1

FlyingDiver wrote:
Have you had a chance to test the version I posted yesterday?


Yes I just finished testing it. I no longer have any issues sending emails.

I truly appreciate your help sorting thru this.

Posted on
Thu Jun 23, 2022 5:50 pm
FlyingDiver offline
User avatar
Posts: 6045
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SMTP mail stopped working after upgrade to 2022.1

Excellent.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 1 guest