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

"Duplicate field in section" MultipartParseException in Email Parse #346

Closed
pllamena opened this issue Oct 4, 2020 · 9 comments
Closed

Comments

@pllamena
Copy link

pllamena commented Oct 4, 2020

Hi @Jericho ,

Thank you for the quick response! I am opening a new issue similar to #202

I am trying to parse the example default payload for inbound email (https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/#example-default-payload). I have it saved as a txt file (attached below), opening it with:

using (var stream = System.IO.File.OpenRead(path)) { var parser = new StrongGrid.WebhookParser(); var inboundEmail = parser.ParseInboundEmailWebhook(stream); ...

The ParseInboundEmailWebhook method throws a "Duplicate field in section" MultipartParseException:
image

Please let me know if I can provide any more details! I triple checked that SendGrid is NOT configured to send the raw format, although I am not sure that matters when working with the default example.

InboundEmail.txt

Thank you!

@Jericho
Copy link
Owner

Jericho commented Oct 4, 2020

I just realized that you are using SendGrid's sample payload. That's the cause of the problem you are experiencing. In fact, it was mentioned in the issue you referenced, in addition to at least one other issue (see discussion in #176).

The inbound email parser in StrongGrid does not work when data posted from SendGrid is in "raw" format and the sample payload provided by SendGrid is in the format we do not support.

@pllamena
Copy link
Author

pllamena commented Oct 4, 2020

Are both samples provided by SendGrid 'raw'? There are two examples in their documentation and I could be wrong, but I thought the first one is not 'raw'.

@Jericho
Copy link
Owner

Jericho commented Oct 4, 2020

I have only witnessed the “Duplicate field in section” exception when attempting to parse a webhook payload in raw format, and I know SendGrid’s sample payload is in raw format. That’s why I concluded that you must be using a sample in raw format.

Why not use the sample I provided back in 2017 (#202 (comment)) or, better yet, get an actual payload posted by SendGrid to you.

@pllamena
Copy link
Author

pllamena commented Oct 4, 2020

Good point, I was focused on the implementation of processing the inbound emails, let me try an actual payload on Monday and I will close the issue if that works.

@Jericho
Copy link
Owner

Jericho commented Oct 4, 2020

Sounds good.

@Jericho
Copy link
Owner

Jericho commented Nov 5, 2020

@pllamena I'm assuming you were able to get this to work therefore I will go ahead and close this issue. Let me klow if that's not the case and I'll be glad to reopen.

@Jericho Jericho closed this as completed Nov 5, 2020
@pllamena
Copy link
Author

pllamena commented Nov 8, 2020

Hi @Jericho , I actually still haven't had a chance to test with a real payload. We run into issues with the dns config where the inbound is not coming through and have been working with SendGrid's support to figure that out, but the actual parser exception is still not resolved on my end.

@Jericho
Copy link
Owner

Jericho commented Nov 8, 2020

While you sort out your DNS issue, have you tried the sample I provided?

@Jericho Jericho reopened this Nov 8, 2020
@pllamena
Copy link
Author

pllamena commented Nov 8, 2020

Yes, that sample worked!

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

No branches or pull requests

2 participants