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

Enrich ImapFolderAgent payload #2076

Merged
merged 3 commits into from
Aug 6, 2017
Merged

Enrich ImapFolderAgent payload #2076

merged 3 commits into from
Aug 6, 2017

Conversation

knu
Copy link
Member

@knu knu commented Aug 3, 2017

This adds message_id and rfc822 (optional) to the payload format of ImapFolderAgent.

A Message-Id value is certainly useful for identifying a mail, and the raw "RFC822" data can be used for further processing or copying to another storage/mailbox.

@knu knu requested a review from dsander August 3, 2017 11:47
Copy link
Collaborator

@dsander dsander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@@ -54,6 +54,8 @@ class ImapFolderAgent < Agent

Set `mark_as_read` to true to mark found mails as read.

Set `include_rfc822` to true to include a raw unencoded mail in each created event.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe swap rfc822 and raw in the option name and description, include_raw_data and to true to include the rfc822 formatted mail in each created event? But I don't feel strongly as I am familiar how common the terms are.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes perfect sense. I'll rename it to raw_mail. Thanks!

@knu knu force-pushed the enrich_imap_agent_payload branch from 148c587 to 4665c30 Compare August 6, 2017 01:02
@knu knu merged commit db5c7ab into master Aug 6, 2017
@knu knu deleted the enrich_imap_agent_payload branch August 6, 2017 16:32
@knu
Copy link
Member Author

knu commented Dec 7, 2017

@dsander Considering that a raw mail is not always a valid UTF-8 byte stream, should we encode it in some way, like Base64?

@dsander
Copy link
Collaborator

dsander commented Dec 8, 2017

@knu Tricky I guess it depends what one wants to do with the raw data. How are you using the feature? If we would base64 encode it could not really be used by anything else in Huginn, right?

@knu
Copy link
Member Author

knu commented Jul 31, 2018

Sorry for the delay... I pass raw email data to Unix commands like sendmail/procmail/formail, so I have no problem if the data is encoded in base64. I just need to pipe it through a decoder like base64(1) and openssl(1).

@dsander
Copy link
Collaborator

dsander commented Aug 1, 2018

I guess it could be an option, woudln't we run into a ruby exception when the email contained invalid UTF-8?

@knu
Copy link
Member Author

knu commented Aug 2, 2018

Emails are often in a "legacy" (non-UTF-8) encoding and JSON is not capable of storing binary data, so I believe this feature, to expose raw data as is, was a mere mistake in the first place. I guess I could pretend I'm the only user and go fix it. 🤣

@dsander
Copy link
Collaborator

dsander commented Aug 3, 2018

Oh I see, you only want to base encode the raw data, yeah that makes sense 😄

@knu knu mentioned this pull request Aug 6, 2018
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

Successfully merging this pull request may close these issues.

2 participants