Git Product home page Git Product logo

mimelib's Introduction

NB! This project is deprecated

All users of this project are urged to find an alternative as it is not maintained anymore. Read more here

mimelib

mimelib is a collection of useful functions to deal with mime-encoded data.

Installation

Install with npm

npm install mimelib

Usage

var mimelib = require("mimelib");

Reference

foldLine

Folds a long line according to the RFC 5322 http://tools.ietf.org/html/rfc5322#section-2.1.1

mimelib.foldLine(str [, maxLength][, foldAnywhere][, afterSpace]) -> String
  • str (String): mime string that might need folding
  • maxLength (Number): max length for a line, defaults to 78
  • foldAnywhere (Boolean): can fold at any location (ie. in base64)
  • afterSpace (Boolean): If true fold after the space

For example:

Content-Type: multipart/alternative; boundary="----zzzz----"

will become

Content-Type: multipart/alternative;
     boundary="----zzzz----"

encodeMimeWord

Encodes a string into mime encoded word format http://en.wikipedia.org/wiki/MIME#Encoded-Word (see also decodeMimeWord)

mimelib.encodeMimeWord = function(str [, encoding][, charset])
  • str (String): String to be encoded
  • encoding (String): Encoding Q for quoted printable or B (def.) for base64
  • charset (String): Charset to be used

For example:

See on õhin test

Becomes with UTF-8 and Quoted-printable encoding

=?UTF-8?Q?See_on_=C3=B5hin_test?=

decodeMimeWord

Decodes a string from mime encoded word format (see also encodeMimeWord)

mimelib.decodeMimeWord(str) -> String
  • str (String): String to be decoded

For example

mimelib.decodeMimeWord("=?UTF-8?Q?See_on_=C3=B5hin_test?=");

will become

See on õhin test

encodeQuotedPrintable

Encodes a string into Quoted-printable format (see also decodeQuotedPrintable)

mimelib.encodeQuotedPrintable(str [, mimeWord][, charset]) -> String
  • str (String): String to be encoded into Quoted-printable
  • mimeWord (Boolean): Deprecated, has no effect, ignore it
  • charset (String): Destination charset, defaults to UTF-8

decodeQuotedPrintable

Decodes a string from Quoted-printable format (see also encodeQuotedPrintable)

mimelib.decodeQuotedPrintable(str [, mimeWord][, charset]) -> String
  • str (String): String to be decoded
  • mimeWord (Boolean): Deprecated, has no effect, ignore it
  • charset (String): Charset to be used, defaults to UTF-8

encodeBase64

Encodes a string into Base64 format. Base64 is mime-word safe (see also decodeBase64)

mimelib.encodeBase64(str [, charset]) -> String
  • str (String): String to be encoded into Base64
  • charset (String): Destination charset, defaults to UTF-8

decodeBase64

Decodes a string from Base64 format. Base64 is mime-word safe (see also encodeBase64)

NB! Always returns UTF-8

mimelib.decodeBase64(str) -> String
  • str (String): String to be decoded from Base64
  • charset (String): Source charset, defaults to UTF-8

parseHeaders

Parses header lines into an array of objects (see parseHeaderLine)

mimelib.parseHeaders(headers) -> Array
  • headers (String): header section of the e-mail

Example:

var headers = [
    "From: [email protected]",
    "To: [email protected]",
    "To: [email protected]",
    "Content-type: text/html;",
    "    charset=utf-8"
    ].join("\r\n");
mimelib.parseHeaders(headers);

Results in

{"from": [ '[email protected]' ],
 "to": [ '[email protected]', '[email protected]' ],
 "content-type": [ 'text/html;    charset=utf-8' ] }

parseAddresses

Parses names and addresses from a from, to, cc or bcc line

mimelib.parseAddresses(addresses) -> Array
  • addresses (String): string with comma separated e-mail addresses

Example:

var to = '"Andris Reinman" <[email protected]>, [email protected]'
mimelib.parseAddresses(to);

Results in

[{ address: '[email protected]', name: 'Andris Reinman' },
 { address: '[email protected]', name: false }]

parseMimeWords

Parses mime-words into UTF-8 strings

mimelib.parseMimeWords(str) -> String
  • str (String): string to be parsed, if includes any mime words, then these are converted to UTF-8 strings

For example:

mimelib.parseMimeWords("Hello: =?UTF-8?Q?See_on_=C3=B5hin_test?=");

Results in

"Hello: See on õhin test"

parseHeaderLine

Parses a header line to search for additional parameters.

mimelib.parseHeaderLine(line) -> Object
  • line (String): a line from a message headers

For example:

mimelib.parseHeaderLine("text/plain; charset=utf-8")imelib

Results in

{"defaultValue": 'text/plain',
 "charset": 'utf-8' }

contentTypes

NB! this feature is deprecated, use mime module instead to detect content types and extensions

mimelib.contentTypes is an object to provide content type strings for common file extensions

mimelib.contentTypes["xls"]; // "application/vnd.ms-excel"

iconv support

By default only iconv-lite support is bundled. If you need node-iconv support, you need to add it as an additional dependency for your project:

...,
"dependencies":{
    "mimelib": "*",
    "iconv": "*"
},
...

License

mimelib is licensed under the European Union Public License 1.1.

mimelib's People

Contributors

andris9 avatar asutherland avatar clarkbw avatar danlec avatar jonathanong avatar lpatters avatar meister avatar sebmaster avatar skabbes avatar stuartcarnie avatar theycallmeswift avatar vitalif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mimelib's Issues

multipart decoding

I have decoded a mail message with var body = mimelib.parseMimeWords(email.body);
Now the resulting text says it is multipart message. What can I do to decode it?
This is the printout of the "body" that I have parsed:

{"date":"2017-01-05T17:37:04.000Z","flags":["\\Seen"],"xgmmsgid":"1555707015811827381","subject":"Re: Your stay in Wien","from":"POPESCU LUMINITA MIHAIELA <[email protected]>","msgid":["<[email protected]>"]}
MIME: This is a multi-part message in MIME format.

--_----------=_14836378243210812
Content-Transfer-Encoding: binary
Content-Type: multipart/alternative; boundary="_----------=_14836378243210813"
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.030 (F2.84; T1.35; A2.06; B3.15; Q3.13)
Date: Thu, 5 Jan 2017 18:37:04 +0100

This is a multi-part message in MIME format.

--_----------=_14836378243210813
Content-Disposition: inline
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"

PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEvL0VO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1pbi9wcml2YWN5Lmh0bWw/bGFuZz1kZSIgc3R5bGU9ImNvbG9yOiMxZmFmZWM7Ij5EYXRlbnNj
aHV0enJpY2h0bGluaWVuPC9hPiB6dS4KPC90ZD48L3RyPjwvdGFibGU+PC90ZD48L3RyPjx0cj48
dGQ+PHRhYmxlIGJvcmRlcj0iMCIgY2VsbHBhZGRpbmc9IjAiIGNlbGxzcGFjaW5nPSIwIiBjbGFz
cz0ibS0xMDBwIiBzdHlsZT0ibWFyZ2luOjAgYXV0bzsiIHdpZHRoPSIxMDAlIj48dHI+PHRkIGFs
aWduPSJjZW50ZXIiIGNsYXNzPSJjb3B5cmlnaHQiIGhlaWdodD0iNTAiIHN0eWxlPSJmb250LWZh
bWlseTpBcmlhbCxIZWx2ZXRpY2Esc2Fucy1zZXJpZjtmb250LXNpemU6MTNweDtjb2xvcjojN2Q5
MGE2OyIgdmFsaWduPSJ0b3AiPgomY29weTsgQ29weXJpZ2h0IDxhIGhyZWY9Imh0dHA6Ly93d3cu
Ym9va2luZy5jb20/c291cmNlPXAyZ19lbWFpbCIgc3R5bGU9ImNvbG9yOiMxZmFmZWM7Ij5Cb29r
aW5nLmNvbTwvYT4gMjAxNgpEaWVzZSBFLU1haWwgd3VyZGUgdm9uIDxhIGhyZWY9Imh0dHA6Ly93
d3cuYm9va2luZy5jb20/c291cmNlPXAyZ19lbWFpbCIgc3R5bGU9ImNvbG9yOiMxZmFmZWM7Ij5C
b29raW5nLmNvbTwvYT4gZ2VzZW5kZXQKPC90ZD48L3RyPjwvdGFibGU+PC90ZD48L3RyPjwvdGFi
bGU+PC90ZD48L3RyPjx0cj48L3RyPjwvdGFibGU+PC9ib2R5PjwvaHRtbD4=

--_----------=_14836378243210813--


--_----------=_14836378243210812--

Release of new version

Right now, last commit for release 0.2.19 is 4 / 5 commits behind.
@andris9 Please release it for Decode with taking care of split multi-byte encodings

Stability.

I have some questions on stability:
How stable is the library?
Is it well tested?
Is it ready for production use?
Will it reach 1.0?

Thanks!

encodeMimeWords missing space after ?=

I don't understand much about those encodings, but this seems to be an issue:

mimelib.encodeMimeWords('Verão você vai adorar!', 'Q', 54, 'utf-8');

Returns the following:

=?UTF-8?Q?Ver=C3=A3o_voc=C3=AA_?=vai adorar!

But i guess it should return like so:

=?UTF-8?Q?Ver=C3=A3o_voc=C3=AA_?= vai adorar!
or
=?UTF-8?Q?Ver=C3=A3o_voc=C3=AA_var?= adorar!

Deprecation warning on node 0.11.6

mimelib 0.2.12

node --trace-deprecation ...

Trace: .get() is deprecated. Access using array indexes instead.
    at Buffer.deprecated [as get] (util.js:83:17)
    at Object.module.exports.mimeFunctions.mimeEncode (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/lib/mimelib.js:191:35)
    at Object.module.exports.mimeFunctions.encodeQuotedPrintable (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/lib/mimelib.js:245:35)
    at Object.module.exports.encodeQuotedPrintable (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/lib/mimelib.js:80:41)
    at MailComposer._emitDataElement (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/lib/mailcomposer.js:1148:32)
    at MailComposer._composeBody (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/lib/mailcomposer.js:1106:22)
    at MailComposer._composeMessage (/home/foxyboy/Desktop/c505/node/meticulous/node_modules/apprunner/node_modules/mailapi/node_modules/nodemailer/node_modules/mailcomposer/lib/mailcomposer.js:565:10)
    at process._tickCallback (node.js:361:11)

Line length limits for email attachments

Hi,

We are getting some bounced emails with the following code:
"smtp; 552 message line is too long"

We use AWS SES service with sendRawEmail, and the email messages have attachments.

I've been going over the structure that builds the raw message for days now, and have added a bunch of new line characters to ensure that no line is longer than 78 characters.

The only potential issue that remains is the actual content of the attachments which is encoded as base64. It doesn't seem that those lines are getting wrapped under 78 or 996 max length character limit. I'm not sure if the actual attachment content also needs to follow that rule, and if it does, how to actually accomplish that, cause introducing new line characters would probably break the actual attachment.

Any suggestions?

foldLine blows up on long quoted-printable lines

For example:

console.log('folded...', require('mimelib-noiconv').foldLine('Subject: =?UTF-8?Q?lalalla_[Problem_Type:__=E7=84=A1=E6=AD=A4=E9=A0=85=E7=9B=AE_problem!]?='));

Will exhaust all memory and crash the process.

emoji support

mime-function.js will throw exception at the code below when "str" contains emoji

this.encodeQuotedPrintable = function(str, mimeWord, charset){
    ...
    return c=="="?"=3D":(charset=="UTF-8"?encodeURIComponent(c):escape(c)).replace(/%/g,'=');
    ...
    return str;

Apostrophe throws off parseAddress

The last name string O'Neill throws off address parsing.

Given the string:

The parse result is:

[
  { address: '[email protected]', name: 'John Doe },
  { address: '[email protected]',
    name: 'Jane O Neill <[email protected]>, Mary <[email protected]>' }
]

The source string of addresses were copied & pasted from Mac Mail's message header section.

parseAddresses with comma (",") in name

Hi Andris,

First thank you for all your great work!

The following issue I'm OFTEN getting into looks like this:
require("mimelib").parseAddresses("Company, Inc. [email protected]")
returns [ ] with
0: Object {address: "", name: "Company"}
1: Object {address: "[email protected]", name: "Inc."}

I know name should be wrapped into "" but can't expect all email senders to behave
so my question:
Is there anything mimelib could do about it ?

Thanks,
Adrian

parseMimeWords doesn't work

mimelib.parseMimeWords("Hello: =?UTF-8?q?See_on_=C3=B5hin_test?=") = "Hello: =?UTF-8?q?See_on_=C3=B5hin_test?=" - it doesn't actually parse.

Don't crash on malformed email address

Mimelib crashes if a malformed name or email address is passed to decodeURIComponent.

Example email header:
To: "accounting%[email protected]"

////node_modules/mailparser/node_modules/mimelib/mime-functions.js:384
            addressArr.push({address:decodeURIComponent(email || ""), name: de
                                     ^
URIError: URI malformed
    at Object.parseAddresses (////node_modules/mailparser/node_modules/mimelib/mime-functions.js:384:38)
    at MailParser._processHeaderLine (/////node_modules/mailparser/lib/mailparser.js:429:48)
    at MailParser._processStateHeader (/////node_modules/mailparser/lib/mailparser.js:321:18)
    at MailParser._process (/////node_modules/mailparser/lib/mailparser.js:202:21)
    at Array.0 (native)
    at EventEmitter._tickCallback (node.js:190:38)

Adding a try/catch around decodeURIComponent should prevent nodejs from completely crashing.

License Question

@andris9 - Two license questions for you:

-Would you be willing to update to EUPL 1.2? It adds more compatible licenses in the Appendix.
-Would you be willing to dual license with MIT, BSD or Apache in case companies are more comfortable with permissive?

Both recommendations would be helpful with increasing adoption of mimelib across the board!

Thanks, in advance, for your consideration!

Hello Andris9

been following your git for a while now might as well work together creating email infrastructure.

possible to re-instate fallback if 'iconv' isn't available?

Back when this was just "mime.js" in the Nodemailer repo there was this for the iconv import:

try{
    // see http://github.com/bnoordhuis/node-iconv for more info
    var Iconv = require("iconv").Iconv;
}catch(E){
    // convert nothing
    Iconv = function(){}
    Iconv.prototype.convert = function(str){return str};
}

Now that is:

// see http://github.com/bnoordhuis/node-iconv for more info
var Iconv = require("iconv").Iconv;

Would it be possible/reasonable to re-instate the optional usage of iconv? Currently I want this because the node-iconv build fails for me on Solaris (I'm looking into the build failure and will report the issue to bnoordhuis/node-iconv separately). However, I could see this optional usage of iconv being useful for scenarios where using binary modules (e.g. iconv) is unwanted or problematic.

Thanks,
Trent

decodeBase64 not work

this is the attachment name. but can not decode
=??B?PT9VVEYtOD9RPz1FNT05Mz1BOD1FNT1BRD05MD01Rj1FOT04Mj1BRT1FNz1BRT1CMT0=?==??B?NUZJT1M9NUY9RTY9QjU9OEI9RTg9QUY9OTU9RTc9OTQ9QTg9RTQ9QkU9OEIyMDE1MTI=?==??B?MjIueGxzeD89?=

Chinese-related problems introduced in 0.2.4

  1. Decoding mail headers with Chinese may throw exceptions. And little we can do to reproduce the problem, as it seemingly occurs at random.

  2. Fail to decode quoted strings which were correctly handled. e.g.

    "=?gb2312?B?ob67otDh1OexqKG/?="

Last working version we used is v0.1.8.

isuue decoding string using decodeMimeWord function

Hi there ,

String =?ISO-8859-1?Q?sendinblue_r=E9pondre.zip?= is received as filename from mac outlook , original filename is sendinblue_répondre.zip.
After decoding it using decodeMimeWord it is converted into sendinblue répondre.zip.

I see in the decodeMimeWord you are replacing underscore with space " " at line number 310.
str = (match[3] || "").replace(/_/g, " ");

Is it an issue or I am doing something wrong ?

If I replace this line with str = (match[3] || "") , will it cause problem in encoding ?

Thanks in advance.

And the license is...?

README.md states "mimelib license is" and then it ends. And LICENSE also has an empty conditions sections. Please clarify if what is reported by npm - MIT - is also what should go there. Do you need a PR to adjust both files then? TIA!

Incorrectly decoding quoted-printable strings

node 0.8.10

In the mimeFunctions#mimeDecode method parseInt explicitly requires a string, however string.match returns an Array, which causes parseInt behave erratically. Will provide patch

Incorrectly mix quoted-words and text in encodeMimeWords

Can't use library with Mandrill SMTP. Subjects with NON-ASCI characters and double quotes when not separated by space incorrectly encoded.

Tests (subject, encoded by Mimelib, decoded by Mandrill):

1 метель" вьюга
1 =?UTF-8?Q?=D0=BC=D0=B5=D1=82=D0=B5=D0=BB=D1=8C?=" =?UTF-8?Q?=D0=B2=D1=8C=D1=8E=D0=B3=D0=B0?=
1 =?UTF-8?Q?=D0=BC=D0=B5=D1=82=D0=B5=D0=BB=D1=8C?="вьюга

2 метель'вьюга
2 =?UTF-8?Q?=D0=BC=D0=B5=D1=82=D0=B5=D0=BB=D1=8C?='=?UTF-8?Q?=D0=B2=D1=8C=D1=8E=D0=B3=D0=B0?=
2 =?UTF-8?Q?=D0=BC=D0=B5=D1=82=D0=B5=D0=BB=D1=8C?='=?UTF-8?Q?=D0=B2=D1=8C=D1=8E=D0=B3=D0=B0?=

According to http://tools.ietf.org/html/rfc2047 part 5.(1)

    an 'encoded-word' that appears in a
    header field defined as '*text' MUST be separated from any adjacent
    'encoded-word' or 'text' by 'linear-white-space'

There is problem with double quotes, single quotes (i assume with characters that isn't matched by \w) .

decodeMimeWord does not work

@andris9 While decoding a mime line using decodeMimeWord does not work, =?Windows-1252?Q?Pr=E9sentation?= Pack Famille - Avantage =?Windows-1252?Q?30=80?= =?Windows-1252?Q?rembours=E9s?=

Can you please have a look ?

Successor to mimelib

Do you know any good alternatives to mimelib? As the readme states, it is deprecated. But I've failed to find a good replacement. Maybe libmime? My usecase is primarily decoding mime headers.

If you have a suggestion to a good alternative, it would be nice to mention under the deprecation warning, to redirect users to your recommendation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.