开发者

Decoding MIME (HTML+Attachments) [closed]

开发者 https://www.devze.com 2022-12-30 03:38 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_JAVA百科

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

I'm planning to write an application that should handle incoming mails. Basically it will act more like a ticketing system than a webmail, so I'm only interested in receiving emails, and not sending them.

I have made a simple prototype that downloads mails and displays the text with downloadable attachments in a web page, but handling mails from Outlook and others is more complicated. I have looked at some of the open source ticketing systems out there, but most of the code is tied to the system and is hard to separate.

Is there a library that understands "rich" mail and makes this job simpler? Preferably in Python, Java, Ruby or Perl. I'm also open to suggestions for any command line mail clients that can be used for this, since the system will not receive large amounts of mail and can afford to launch external processes.

Edit:

I know about the standard mail libraries in Python and Java and can handle the mail itself, but I'm looking for a library that can help me with the "rich" emails created by Outlook/Thunderbird that contains formatting and inline images.


There are several email-handling packages in the Python standard library. I haven't worked with them very much, so I'm not sure whether they do quite what you intend, but if you haven't already I would suggest taking a look at e.g. the email package.

If you're looking for something higher-level than that, I'm sure there are third-party libraries available.


For Perl, check out Ricardo Signes' Email::MIME for parsing multipart messages. Check out walk_parts, it recursively applies a callback to each part of a multipart message.


Python has the aptly-named email package for handling email messages.


Java has the Javamail API that can handle MIME attachments.


PHP has the imap functions with imap_fetchstructure and imap_fetchbody u can handle all type of Emails but its kinda hard.

U can also look at http://www.squirrelmail.org/ and rip off the email view part.


The Zend Framework has a package called Zend_Mail that can handle multipart emails, attachments, MIME content and HTML emails

The link is here


What you desire is not available right now in java (as far as I know), you need to receive the email data stream and create your own wrapper over email parser libraries.

I have created similar solution in java that takes in incoming email data stream and gives out an email object that contains email body (plain text and html both), attachments etc.

It's able to handle mails from all of the email clients that I know atleast.

I use mime4j(email data stream parser) for my task and it's much better than java mail api.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号