Problem/Motivation

Hi, I have no idea what that could mean or where I should look:

The error below happens for the following scenario:

Current D8.2.6
Inmail latest dev.

Sending an email from a known user to a mailbox which is handled by an imap deliverer.
Connecting works.

Please, can someone point me into the right direction?
Thanks

Error:
Call to a member function getAddress() on array in /web/modules/mailhandler/src/Plugin/inmail/Analyzer/SenderAnalyzer.php on line 47

Since recently, Inmail has been updated to support multiple From addresses instead of only one. This was correct update since RFC 5322 does not limit From field to one address. However, this change broke PGPAnalyzer and SenderAnalyzer in Mailhandler.

Proposed resolution

Update PGP Analyzer and Sender Analyzer to use first From address and support multiple in #2861923: Support multiple From addresses.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

maxilein created an issue. See original summary.

miro_dietiker’s picture

Priority: Normal » Major

From quickly reading the stacktrace, it looks like your mail has no valid sender information. Possibly a filtered header by MTA?

This should never happen, but we should also make sure we don't fail hard. We might want to add an invalid mail example that triggers this case.

Could you show us the full headers of this mail?

maxilein’s picture

Thanks.
Where should I get the full headers of the mail from?

miro_dietiker’s picture

You can extract the mail headers of a message with any mail client connecting to the MDA.

maxilein’s picture

Taken from the mailbox where inmail downloads the message from:

Delivered-To: test@email.net
Return-Path:
Delivered-To: test@email.net
Received: from proxy18.mail.iad3a.rsapps.net ([172.27.0.39]) by store537a.mail.iad3a.rsapps.net (Dovecot) with LMTP id qWNHAq78mVj8fAAA3Q1/tQ for ; Tue, 07 Feb 2017 11:58:22 -0500
Received: from smtp29.gate.iad3a ([172.27.00.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.iad3a.rsapps.net (Dovecot) with LMTP id V6bbGFj8mVjKYAAAon3hFg ; Tue, 07 Feb 2017 11:58:22 -0500
Return-Path:
X-Spam-Exception: WHITELISTED
X-Spam-Threshold: 95
X-Spam-Score: 0
X-Spam-Flag: NO
X-Virus-Scanned: OK
X-MessageSniffer-Scan-Result: 0
X-MessageSniffer-Rules: 0-0-0-6877-c
X-CMAE-Scan-Result: 0
X-CNFS-Analysis: v=2.2 cv=T9HOdLCQ c=1 sm=1 tr=0 a=T3XMvFr6cJA2U4N+7glfYQ==:117 a=T3XMvFr6cJA2U4N+7glfYQ==:17 a=IkcTkHD0fZMA:10 a=0UE7tQH-uMIA:10 a=n2v9WMKugxEA:10 a=3pPhOZIsAAAA:8 a=54cpfGXm2VLYVQu94RYA:9 a=TBXxTzI5UHQ13n7u:21 a=cFdTRT9OfdpuhP9N:21 a=QEXdDO2ut3YA:10 a=7GNzD-Y9mrcA:10 a=8C_leJKRgBfpm2z_b9d-:22
X-Orig-To: test@email.net
X-Originating-Ip: [173.203.00.117]
Authentication-Results: smtp29.gate.iad3a.rsapps.net; iprev=pass policy.iprev="173.203.00.117"; spf=pass smtp.mailfrom="my@email.net" smtp.helo="smtp117.iad3a.svr.com"; dkim=none (message not signed) header.d=none; dmarc=none (p=nil; dis=none) header.from=email.net
X-Classification-ID: a1c559ea-ed56-11e6-b774-bc305bf5a2b4-1-1
Received: from [173.203.00.117] ([173.203.00.117:60141] helo=smtp117.iad3a.svr.com) by smtp29.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C3/D6-17337-DACF9985; Tue, 07 Feb 2017 11:58:21 -0500
Received: from smtp7.relay.iad3a.svr.com (localhost [127.0.0.1]) by smtp7.relay.iad3a.svr.com (SMTP Server) with ESMTP id CF0054DB3 for ; Tue, 7 Feb 2017 11:58:21 -0500 (EST)
X-Auth-ID: m.zam@eamil.net
Received: by smtp7.relay.iad3a.svr.com (Authenticated sender: m.zam-AT-email.net) with ESMTPSA id 2F5FB4F76 for ; Tue, 7 Feb 2017 11:58:20 -0500 (EST)
X-Sender-Id: m.zam@eamil.net
Received: from INVEN (178.115.00.184.wireless.dyn.drei.com [178.115.00.184]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:465 (trex/5.7.12); Tue, 07 Feb 2017 11:58:21 -0500
From: "MY"
To:
Subject: RE: Test 3
Date: Tue, 7 Feb 2017 17:58:19 +0100
Message-ID: <000b01d28163$63776480$2a662d80$@eamil.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AdKBY2G2I+ag7L3lQ+2wUrOILWxksQ==
Content-Language: de-at

kovtunos’s picture

it looks like your mail has no valid sender information

@miro_dietiker: I'm trying to use Inmail together with Mailhandler. They provide demo module where there are some test email messages. Inmail fails on that messages also with this error.
A couple of headers from here:

Message-Id: <uHuKgG2zs0XNpLJeOFJx2HyG07lZ8tnC@example.com>
Received: from mail.example.com; Wed, 27 May 2015 15:42:10 +0200
Date: Wed, 27 May 2015 15:42:10 +0200 (CEST)
From: Bob <bob@example.com>
To: Alice <alice@example.com>
Subject: Re: Hello
MIME-Version: 1.0
Received: by 10.140.83.146 with HTTP; Fri, 18 Nov 2016 01:44:28 -0800 (PST)
Date: Fri, 18 Nov 2016 10:44:28 +0100
Delivered-To: alice@example.com
Message-ID: <CAE42c6tEJokrrCzUnp8aB1wnU5ojP_Nn4gz_a99NwO9KgfuZEg@mail.example.com>
Subject: Multipart-alternative HTML
From: Bob <bob@example.com>
To: Alice <alice@exampel.com>
Content-Type: multipart/alternative; boundary=001a11c13524faa56005419026d
maxilein’s picture

I believe it has to do something with the entire configuration and/or sub optimal error handling - not so much with the message itself.

I am using the smtp-module for sending emails. But I could not find any documentation whether this is a supported configuration ...

Since this module lacks any kind of documentation it is very hard to figure anything out here...

Could someone please help?

maxilein’s picture

I am getting the exacct same error when testing with the paste message templates from the inmail demo module.
Can you point me to the position in code where the module tries to send its messages?

maxilein’s picture

StatusFileSize
new520 bytes

Hi,

Used settings which do not seem to be too common...

IMAP/POP3 Deleiverer/Fetcher

here is the first part of a solution which corrects the access to the returned array.
Now the fatal error is gone.

I wonder why this never came up before?

maxilein’s picture

So now I get a notice:

Notice: Unknown: Sequence out of range (errflg=2) in main() (line of ) #0 /.../core/includes/bootstrap.inc(548): _drupal_error_handler_real(8, 'Unknown: Sequen...

Someone here says: https://github.com/geerlingguy/Imap/issues/14

This happens whenever I check for new messages and there are none. Which is quite annoying, in my logs :)

https://bugs.php.net/bug.php?id=64199&thanks=6

Please add a note to this page that using a sequence outside the range of existing messages, or more importantly, a range of 1:1 when there aren't any messages, will result in the notice:

PHP Notice: Unknown: Sequence out of range (errflg=2) in Unknown on line 0

maxilein’s picture

Project: Inmail » Mailhandler D8
Version: 8.x-1.x-dev »
Component: Analyzers » Code

Moving this, because I also saw some other related issue there.

maxilein’s picture

maxilein’s picture

Project: Mailhandler D8 » Mailhandler
Version: » 8.x-1.x-dev
Component: Code » Mailhandler
maxilein’s picture

StatusFileSize
new571 bytes

Here is the second patch.
You need both to make the error go away for unencrypted and encrypted mail.

mbovan’s picture

Status: Active » Needs work

#9 and #14 seem correct due to changes introduced in Inmail related to getFrom() method.

Could you make one patch combined (based on #9 and #14) and upload it here? Make sure to change a comment status to "Needs review" in order to trigger test run. Thanks!

maxilein’s picture

StatusFileSize
new1.08 KB

Combined analyzer patch.

maxilein’s picture

Status: Needs work » Needs review

The last submitted patch, 14: PGPAnalyzer.php_.patch, failed testing.

The last submitted patch, 14: PGPAnalyzer.php_.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 16: Analyzer.patch, failed testing.

maxilein’s picture

StatusFileSize
new1.15 KB
maxilein’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 21: Analyzer-2.patch, failed testing.

mbovan’s picture

Status: Needs work » Needs review
mbovan’s picture

Title: Error: Call to a member function getAddress() » Let analyzers use first From address
Issue summary: View changes

Updated the issue title/description.

  • mbovan committed 53ecf46 on 8.x-1.x authored by maxilein
    Issue #2850498 by maxilein, mbovan: Let analyzers use first From address
    
mbovan’s picture

Status: Needs review » Fixed
StatusFileSize
new1.09 KB

As mentioned in the updated issue summary, Inmail was updated to support multiple From addresses.

#21 fixes it by enabling analyzers to use the first From address.
To support this edge case, I created a follow-up #2861923: Support multiple From addresses.

Committed #21 with a comment. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.