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

Missing address value in address headers (ie. Return-Path) not handled properly, resulting in Exception #230

Closed
imvishalpatel opened this issue Oct 18, 2019 · 5 comments

Comments

@imvishalpatel
Copy link

If you find Return-Path in email source it is empty and because of it the EmailConverter throwing an exception.
This email is a bounce email of Gmail. The recipient was not valid so Gmail could not deliver.

But it should not throw exception.

Exception

org.simplejavamail.converter.internal.mimemessage.MimeMessageParseException: Error parsing [Return-Path] address at org.simplejavamail.converter.internal.mimemessage.MimeMessageParser.createAddress(MimeMessageParser.java:253) at org.simplejavamail.converter.internal.mimemessage.MimeMessageParser.parseHeader(MimeMessageParser.java:154) at org.simplejavamail.converter.internal.mimemessage.MimeMessageParser.parseMimePartTree(MimeMessageParser.java:115) at org.simplejavamail.converter.internal.mimemessage.MimeMessageParser.parseMimeMessage(MimeMessageParser.java:108) at org.simplejavamail.converter.EmailConverter.mimeMessageToEmailBuilder(EmailConverter.java:64) at org.simplejavamail.converter.EmailConverter.mimeMessageToEmail(EmailConverter.java:55) at com.f.service.emailconfig.custom.FtAbstractMailReceiver.receive(FtAbstractMailReceiver.java:386) at com.f.service.notification.EmailReaderImpl.read(EmailReaderImpl.java:75) at com.f.service.notification.EmailReaderImpl$$FastClassBySpringCGLIB$$362b50e7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) at com.f.service.notification.EmailReaderImpl$$EnhancerBySpringCGLIB$$1ff5237e.read(<generated>) at com.f.ms.scheduler.emailjob.EmailJob.executeJob(EmailJob.java:57) at com.f.service.scheduler.job.EmailJobHelper.executeInternal(EmailJobHelper.java:29) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: javax.mail.internet.AddressException: Empty address in string ``'' at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:1275) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:1215) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:752) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:119) at org.simplejavamail.converter.internal.mimemessage.MimeMessageParser.createAddress(MimeMessageParser.java:251) ... 16 more

Email source :

`Delivered-To: [email protected]
Received: by 2002:a1c:7dcf:0:0:0:0:0 with SMTP id y198csp465881wmc;
Thu, 17 Oct 2019 23:54:00 -0700 (PDT)
X-Received: by 2002:aa7:8b02:: with SMTP id f2mr5059936pfd.151.1571381640306;
Thu, 17 Oct 2019 23:54:00 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1571381640; cv=none;
d=google.com; s=arc-20160816;
b=tL/tC3Ig+iB7GAqZAPdAKkC6qVCI8IBQNd0eID/1shjBIprHCNiCITrqlP6j+VyhPa
JeBh4mSBnf1UaxkLVLt8758FPF8ik5nIvTNVKeSl8abC++RMwja2atWV9N3qFEA8Jme/
JSizWcSw+/Xvq3m267Ae5X2N4nmzvvwLLfnlfHQ9lmj5xEVUOJomGqc7i9bOwNrDO2ek
wqbZ5rm9vhQeQLKsPCu+/rz/OeZ/UN4fKJnersXgTPdcMh3dml6H2I/mDUoktZ3WqUU1
Khg1vxvLPHKiLv5XZiF4UATDxFtnULGJdiF5kj6uUpJQXNvfI2iDk39dQgO+WSZvRDQG
/nUg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=in-reply-to:references:subject:from:date:message-id:auto-submitted
:to:dkim-signature;
bh=ttMGxUey+Sgl9OTfSXRsySTZdSp9qixrn/bqUgW+qvE=;
b=IPtGr0mGx0NSfRg/k9+8537fB+tnDs0kdiD1ZBOjIFdYuN17rUkY8/RwkGJH7bUDeW
GS0vluEOisUTB3G5cMoiE+h0yVJPLMLlKgmQDtCGz8evWXOFiQjBgmQgvNup5tqriW3f
gx09nS+2L4GSQbfUfhHHZVWY0MWqKyPcvHC3nuMqod0t1tjmy1NcaxXwMv6yg0VTUrRf
A8SGzSbRyNAdaTbE3Vscxg6CMmOJcqM+B6IAjIVYtg4cufTZv8mYR7dFV8PLjnN7/jDB
DBf0F5SjzBXQ3mGBRLLiKBkWieNp4GwltOxNnJG1sbqc3y8HtNR/IBIgJJy2iHqS7jSq
NNAg==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass [email protected] header.s=20161025 header.b=bsTIdI3j;
spf=pass (google.com: best guess record for domain of [email protected] designates 209.85.220.69 as permitted sender) smtp.helo=mail-sor-f69.google.com;
dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com
Return-Path: <>
Received: from mail-sor-f69.google.com (mail-sor-f69.google.com. [209.85.220.69])
by mx.google.com with SMTPS id x125sor5001116pfx.15.2019.10.17.23.54.00
for [email protected]
(Google Transport Security);
Thu, 17 Oct 2019 23:54:00 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of [email protected] designates 209.85.220.69 as permitted sender) client-ip=209.85.220.69;
Authentication-Results: mx.google.com;
dkim=pass [email protected] header.s=20161025 header.b=bsTIdI3j;
spf=pass (google.com: best guess record for domain of [email protected] designates 209.85.220.69 as permitted sender) smtp.helo=mail-sor-f69.google.com;
dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20161025;
h=to:auto-submitted:message-id:date:from:subject:references
:in-reply-to;
bh=ttMGxUey+Sgl9OTfSXRsySTZdSp9qixrn/bqUgW+qvE=;
b=bsTIdI3jmIW13EtR/xgj8mkOlTWIuNYIGpQfF2fMVqTYE2KnJ4RaAJIVIT7U+sur/2
W8RX/RZHrNBVM+Z0v18b/Sike7RuofWjxXn/QEyDCTu6P8afI6qbhWJzQzRjAgMcU4s5
rgaQu8K0TcZR2g3PJowP8d6AD9+QMup76oBb1zLgpeAyD8gR49YJPeA0n6Lliy5oZgn1
ieij6AXXUzDR3k3LRoBxME0d/p8nwatt5/8DySCAVfHjFmQNtC7iCOt2BVwMAVKcmS3Q
WBmx8k6jD1Mo2DleLzGw9W8aNaljY0Y/wOD4Sli47NqttMblioB7O73p00jvACP2AMdN
Dghw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:auto-submitted:message-id:date:from:subject
:references:in-reply-to;
bh=ttMGxUey+Sgl9OTfSXRsySTZdSp9qixrn/bqUgW+qvE=;
b=S4QTCdsXjbawYdAdkxX7lx+PE3VZOYmPe+vdaXOseamv4O534EuGNF/ah9bpjLa31p
b0DnQRCCybnwassr2RPWQz6HuSkUqI8dj9tyJhsM2SIH/dmXlo2SfhIjVSBbJ2knIee6
GSHqEoClQACj2rM+mZHev+ojTGkPEkil4NooPbFRtKKLh89Extr1ASpM+VBuqF7NYh9I
XiuGgJ9b/8AIH1I3CXOXXxpaDXHdtut/c6i6GaIM6WbDsLN9O5dJPiLxyd3UBJUqX0DM
ff5QzQXUHCKBN/cDEZRXSecMf/RS5jESwJBN1gy+3urPL24g84eAkZ5yLPoOeKD+gQFY
MiCg==
X-Gm-Message-State: APjAAAULWVwr7YgLV/A5cZFFluPJdfjN574/uM0p40uI4iON/PoiolWr
gbaMdZdMd/vgqVOvghQikcUQxIvnqWq1+iHYXaadLg==
X-Google-Smtp-Source: APXvYqz4uRygjhYFweK9MRwqr6RaFPo/L8p+YpnBhHzJGXXgwx0RswatqLQhbfbvf/NaNATAHWnP/BN6m0YM869VTq4DVuenu1Pc6xo=
X-Received: by 2002:a62:2643:: with SMTP id m64mr4710118pfm.232.1571381639982;
Thu, 17 Oct 2019 23:53:59 -0700 (PDT)
Content-Type: multipart/report; boundary="000000000000752158059529cc5e"; report-type=delivery-status
To: [email protected]
Received: by 2002:a62:2643:: with SMTP id m64mr3757499pfm.232; Thu, 17 Oct
2019 23:53:59 -0700 (PDT)
Return-Path: <>
Auto-Submitted: auto-replied
Message-ID: [email protected]
Date: Thu, 17 Oct 2019 23:53:59 -0700 (PDT)
From: Mail Delivery Subsystem [email protected]
Subject: Delivery Status Notification (Failure)
References: 1273968289.464.1571381637500@ubuntu
In-Reply-To: 1273968289.464.1571381637500@ubuntu
X-Failed-Recipients: [email protected]

--000000000000752158059529cc5e
Content-Type: multipart/related; boundary="000000000000752aa1059529cc69"

--000000000000752aa1059529cc69
Content-Type: multipart/alternative; boundary="000000000000752aa8059529cc6a"

--000000000000752aa8059529cc6a
Content-Type: text/plain; charset="UTF-8"

** Address not found **

Your message wasn't delivered to [email protected] because the domain tech.com couldn't be found. Check for typos or unnecessary spaces and try again.

The response was:

DNS Error: 2829201 DNS type 'mx' lookup of tech.com responded with code NOERROR
2829201 DNS type 'mx' lookup of tech.com had no relevant answers.
2829201 DNS type 'aaaa' lookup of tech.com responded with code NOERROR
2829201 DNS type 'aaaa' lookup of tech.com had no relevant answers.
2829201 DNS type 'a' lookup of tech.com responded with code NOERROR
2829201 DNS type 'a' lookup of tech.com had no relevant answers.

--000000000000752aa8059529cc6a
Content-Type: text/html; charset="UTF-8"

<style> * { font-family:Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; } </style>
Error Icon

Address not found

Your message wasn't delivered to [email protected] because the domain tech.com couldn't be found. Check for typos or unnecessary spaces and try again.
The response was:

DNS Error: 2829201 DNS type 'mx' lookup of tech.com responded with code NOERROR 2829201 DNS type 'mx' lookup of tech.com had no relevant answers. 2829201 DNS type 'aaaa' lookup of tech.com responded with code NOERROR 2829201 DNS type 'aaaa' lookup of tech.com had no relevant answers. 2829201 DNS type 'a' lookup of tech.com responded with code NOERROR 2829201 DNS type 'a' lookup of tech.com had no relevant answers.

--000000000000752aa8059529cc6a--
--000000000000752aa1059529cc69
Content-Type: image/png; name="icon.png"
Content-Disposition: attachment; filename="icon.png"
Content-Transfer-Encoding: base64
Content-ID: <icon.png>

iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAABYlAAAWJQFJUiTwAAAA
GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABTdJREFUeNrsnD9sFEcUh5+PRMqZ
yA0SPhAUQAQFUkyTgiBASARo6QApqVIkfdxGFJFSgGhJAUIiBaQB0ZIOKVCkwUgURjIg2fxL4kS+
YDvkbC/388bi8N16Z4/d7J/5PsniuD3fyePP772ZeTsDQRAYQL/UGAJAIEAgQCBAIAAEAgQCBAIE
AkAgyJT3Mv+Eq7vYK8mTE+MDRCAghQECAeRQA5V2ZOpmg5vDx3NPzRbmGRMEcmTrEbNNB8zWfRD+
f/Efs2e3zCZvMjaksBg27TfbcuSNPEKP9ZyuAQKtHX2O9ncNgWC57umMPKvRNb0GEKgnLoUyxTQC
rcns0/6uIRAs8/hGf9cQCJZpTpjdO2f25/03z+mxntM1eLtsZAgiUtX4JcaBCAQIBAgECARQ8CJa
G5jab4J4pm4WZmO3OALVh802fIwcLkyPkcKAGggAgQCBAIEAgQCBABAIEAjKA/1AnahhbO5FdOOY
VsrrDbPBYcYKgf5D2wLaV3p+22xh1u17tO3S+DTcvxvagUDeivPgx/a/95J/73w7Sj26Hn4pKo2M
ehuV/KyBJM6d0f7k6RKx/R63vvL2tmf/ItDdM2ZTP6f7nkp9Y2fDx1v9akmpIU+KSCLVUghUQfSL
zVKeTklbLxGoctw/nzC5rw8L5KRNbkpnKq6pgSqEClzNnFzY+XnYWrt6VpVk1vbwWvg+RKCKMOUw
Q1LEOXA+/MX3mpJvGDHb265xtnzmFoUK1HaKQGlMtePYM+q2KKjXuaS1NJYIEKgI8jhEgqHt4cqy
Ky53j3hyHz2bqSLp2o2LbJ7MxKovkGqXteoWpaOk96O9/yF/dF7NwlS36AuIQIBA5celQK4PIxBE
4LLzrtoLgaALdSy6CJRkWQCBPGLsTHznomZ9nszUECgJ2ml3WWHe+QVFNPSQx6UdZNtxr9pbEShN
eTTz8mQXHoHSlke7+Z+c9m6VGoHSkEfs/trLW3wQKApN1V3lGfnGu2Z6BFoLtYCs3GWBPAiUCLVh
/HoaeRCoT9R873KLM/IgUBfapnCpe5AHgXry4pf412ihEHkQqCdxd5VqrcezhUIESsJMTJ+Pdthp
Z0WgyNlXXPHc2Mc4IVAELl2Gnh8mhUDvCkfbIVAkcbf/aOoO3fMKhqAD3frTa4quwpn0hUDOkQhI
YYBAgECAQAAU0QlYObl+5Ug8NcprZkZxjUCxRPVA6zmtEXHCBykskrhjgHXN09PoEcgFl4M4H11j
nBAoApcj6ZoPGScEAgTKApcDoTw5sgWB+sGlz1n90IBAPdE6j1o21PfcC11jLagL1oFWRyGlKU3p
OxcSJQ7NZAjkhHp/uG2HFAYIBAgECASAQIBAgECAQAAIBOkxEARBtp9wdVfAMOfIifEBIhCQwgCB
ABAI0oV2jhxZ+nfBatuPZfgBCy0Eqqo8c01b+uu51XZvzOgDWoHNTGR+pCwpLEd5svuAZXlO2uEr
PyEQ8hRWHgRCHmqg0sjTnLalv6crJQ8C/U8stqNO0I4+VZOHFIY8COS1PGL2ybd5yUMKK7s8zYmL
dujyd3n+nESgcsvzZd4/KwIhDwIhT35QA6UyE1qyxZnfvJMHgdKS549JC1qvvJOHFIY8CFR5eV5O
XimqPAhUdHnmfx+zgxdOFXkoqIGKKs/cswnb/8Oeog8HEai48nxUhiFBIORBIOShBioskkbySCLk
IQIhDwIhj28p7FApR6b1qlEbHGpkO/rr6215vi/zH1r2x7tApSGFAQIBAgECAQIBIBAgECAQIBBA
LK8FGADCTxYrr+EVJgAAAABJRU5ErkJggg==
--000000000000752aa1059529cc69--
--000000000000752158059529cc5e
Content-Type: message/delivery-status

Reporting-MTA: dns; googlemail.com
Received-From-MTA: dns; [email protected]
Arrival-Date: Thu, 17 Oct 2019 23:53:58 -0700 (PDT)
X-Original-Message-ID: 1273968289.464.1571381637500@ubuntu

Final-Recipient: rfc822; [email protected]
Action: failed
Status: 4.0.0
Diagnostic-Code: smtp; DNS Error: 2829201 DNS type 'mx' lookup of tech.com responded with code NOERROR
2829201 DNS type 'mx' lookup of tech.com had no relevant answers.
2829201 DNS type 'aaaa' lookup of tech.com responded with code NOERROR
2829201 DNS type 'aaaa' lookup of tech.com had no relevant answers.
2829201 DNS type 'a' lookup of tech.com responded with code NOERROR
2829201 DNS type 'a' lookup of tech.com had no relevant answers.
Last-Attempt-Date: Thu, 17 Oct 2019 23:53:59 -0700 (PDT)

--000000000000752158059529cc5e
Content-Type: message/rfc822

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=date:from:reply-to:to:message-id:subject:mime-version;
bh=p7tvdvEYOoF6W0/NUtYZWmLre0daU8YxrBi88MPpdSM=;
b=ZxD8JldqL2u26bSoJjwFfWUVkGarGTUGvUw1zjGhUKUAnboFELM36z/RgGHz5Y+bcf
M/ZOoPlS1wGV3GJ3ZWLMjaVj/eT+94MhlRZJxSApJEXV1Pp97yVeabkvhnVe5Etq/Zec
mfwLh6mMJbHAdu75mCS1hH0+6c1ADlaZ2gO2UT3Ma/nLwW9lq1jfwazfhcHl1cQndDJA
znBezbW0blwfxPHSthZCk06fdQ4WSQqEkYmcqYwSpQKWT4PB/x4eLdjXUvjOrdXD4xbw
cI9JE+9hij44UTy04BqU7/93XPquB29VGEaGci0GBfRUPTHvHJmLRnCLeGwiVyEPkfPp
ohew==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:date:from:reply-to:to:message-id:subject
:mime-version;
bh=p7tvdvEYOoF6W0/NUtYZWmLre0daU8YxrBi88MPpdSM=;
b=I/uo9AQzBEk+3cwcftk/d8F5tTbSrtK0W8nfchUCk0eFAzuemf5MdU9xDtuRkDEg3X
KuLXnBe5ye2Q0hBXYPhdW1UBB+0PMkC4/HN+6uRmEPq6QGeOmmbGEDY2iBEM0jl7WCS2
1fUlwVLVrRI2tPJqZqwLXJk9co0kRqrkf6IRCq0VRRlY91BAJNWQP6yzu3u2srHrYIT0
nLqoPM+eEPr3hFBhb5ojSYobdlSMONuBt8yqhCZLSj8mkTX0bG+J/7mxfdD5qZAQWsd7
4L2aszTJDa4Ix7daTfK1YZ3WQTMu39G2LgsNngqKs8FGr9GiWYPc6DB226EQysmq1E2H
hGTQ==
X-Gm-Message-State: APjAAAVDVxCSkXtXuVNVqP6K+z4CT0Ke9Y/9THxuWo9LJ8QhEbt0ZaHZ
omkvLuF0C8BW8MTdFF13oTPu/Wlh
X-Google-Smtp-Source: APXvYqxpAuAVJuq/PZ8YdI93iz0hNOkWZQJIii9++sQTYrJiP8wdPu7DqzPkzSblQAFhI6d0cjEA/w==
X-Received: by 2002:a62:2643:: with SMTP id m64mr4710095pfm.232.1571381639596;
Thu, 17 Oct 2019 23:53:59 -0700 (PDT)
Return-Path: [email protected]
Received: from ubuntu ([59.144.124.161])
by smtp.gmail.com with ESMTPSA id p66sm5944711pfg.127.2019.10.17.23.53.57
for [email protected]
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 17 Oct 2019 23:53:58 -0700 (PDT)
Date: Fri, 18 Oct 2019 12:23:57 +0530 (IST)
From: Support [email protected]
Reply-To: [email protected]
To: [email protected]
Message-ID: 1273968289.464.1571381637500@ubuntu
Subject: Activate your apolo account
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_462_2040689480.1571381629958"

------=_Part_462_2040689480.1571381629958
Content-Type: multipart/related;
boundary="----=_Part_463_702268287.1571381629958"

------=_Part_463_702268287.1571381629958
Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: 7bit

<style> table { border-collapse: collapse; empty-cells: show; } table td, table th { border: 1px solid #ddd; } p { margin: 0; } </style>

Hi tech1,

------=_Part_463_702268287.1571381629958--

------=_Part_462_2040689480.1571381629958--

--000000000000752158059529cc5e--
)`

@bbottema
Copy link
Owner

bbottema commented Oct 18, 2019

Reading the email details, it seems the Return-Path is not just empty, it contains an invalid value ("<>").

Could you attach the file as an eml file? You can just paste it into Github.

@bbottema bbottema added this to the 5.6.0 milestone Oct 18, 2019
@bbottema bbottema changed the title Throwing exception while parsing MimeMessage to Email Object due to Return-Path is empty. Missing address value in address headers (ie. Return-Path) not handled properly, resulting in Exception Oct 20, 2019
@bbottema
Copy link
Owner

Fix released in 5.5.1.

@bbottema bbottema modified the milestones: 5.6.0, 5.5.1 Oct 20, 2019
@imvishalpatel
Copy link
Author

I use maven for this dependency. but I could not find latest 5.5.1 in maven repo. Please update. Thanks for your quick support.

https://mvnrepository.com/artifact/org.simplejavamail/simple-java-mail

@bbottema
Copy link
Owner

Actually, I can already see it: https://search.maven.org/search?q=g:org.simplejavamail%20AND%20a:simple-java-mail&core=gav

It's available, but your link doesn't show it yet for some reason.

@imvishalpatel
Copy link
Author

Thanks. I was able to use the latest 5.5.1 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants