EmailParser: Use of uninitialized value $Email

Moderator: crythias

Post Reply
robbit
Znuny newbie
Posts: 4
Joined: 08 Apr 2015, 19:23
Znuny Version: 4.0.16

EmailParser: Use of uninitialized value $Email

Post by robbit »

Hello,

with OTRS 4.0.16 there is a problem that sometimes during running the cronjob otrs.PostMasterMailbox.pl, the following error occurs:

Code: Select all

[Wed Jan 31 12:33:04 2018] otrs.PostMasterMailbox.pl: Use of uninitialized value $Email in hash element at /opt/otrs-4.0.16/Kernel/System/EmailParser.pm line 981.
[Wed Jan 31 12:33:04 2018] otrs.PostMasterMailbox.pl: Use of uninitialized value $Email in hash element at /opt/otrs-4.0.16/Kernel/System/EmailParser.pm line 986.
[Wed Jan 31 12:33:04 2018] otrs.PostMasterMailbox.pl: Use of uninitialized value $Email in hash element at /opt/otrs-4.0.16/Kernel/System/EmailParser.pm line 981.
[Wed Jan 31 12:33:04 2018] otrs.PostMasterMailbox.pl: Use of uninitialized value $Email in hash element at /opt/otrs-4.0.16/Kernel/System/EmailParser.pm line 982.
Relevant snippet from EmailParser.pm:

Code: Select all

[...]
 966 =item _MailAddressParse()
 967
 968     my @Chunks = $ParserObject->_MailAddressParse(Email => $Email);
 969
 970 Wrapper for C<Mail::Address->parse($Email)>, but cache it, since it's
 971 not too fast, and often called.
 972
 973 =cut
 974
 975 sub _MailAddressParse {
 976     my ( $Self, %Param ) = @_;
 977
 978     my $Email = $Param{Email};
 979     my $Cache = $Self->{EmailCache};
 980
 981     if ( $Self->{EmailCache}->{$Email} ) {
 982         return @{ $Self->{EmailCache}->{$Email} };
 983     }
 984
 985     my @Chunks = Mail::Address->parse($Email);
 986     $Self->{EmailCache}->{$Email} = \@Chunks;
 987
 988     return @Chunks;
 989 }
 [...]
Calls of the relevant method:

Code: Select all

[...]
 216     for my $EmailSplit ( $Self->_MailAddressParse( Email => $Param{Email} ) ) {
 217         $Email = $EmailSplit->address();
 218     }
[...]
 252     for my $EmailSplit ( $Self->_MailAddressParse( Email => $Param{Email} ) ) {
 253         $Realname = $EmailSplit->phrase();
 254     }
[...]
 275     for my $Line ( $Self->_MailAddressParse( Email => $Param{Line} ) ) {
 276         push @GetParam, $Line->format();
 277     }
I already tried to help myself by printing $Param{Email} and $Self->{EmailCache} after the declaration of $Email and $Cache. I noticed that $Self->{EmailCache} is empty sometimes although there is a value for $Email.

Thanks in advance for helping me out. ;)
Meine Meinung steht fest - verwirrt mich nicht mit Tatsachen. :P
fcasal
Znuny wizard
Posts: 336
Joined: 21 Apr 2014, 16:14
Znuny Version: 6.0.18

Re: EmailParser: Use of uninitialized value $Email

Post by fcasal »

The first thing I would do is to upgrade at least to the last patch version of otrs 4.
Post Reply