orliesaurus/nodemailer-mailgun-transport

Transport drops out Content-Disposition and Content-ID headers from attachments

Closed this issue · 10 comments

I'm trying to send mail with embedded images through mailgun transport. I was expecting to see following headers in the received mail:

Content-Type: image/gif; name=timantti.gif
Content-ID: <timantti@superselfiestick.fi>
Content-Disposition: inline; filename=timantti.gif
Content-Transfer-Encoding: base64

but only

Content-Disposition: attachment; filename="timantti.gif"
Content-Type: image/gif; name="timantti.gif"
Mime-Version: 1.0
Content-Transfer-Encoding: base64

were passed...

Looks like many of the nodemailer options are just dropped here https://github.com/orliesaurus/nodemailer-mailgun-transport/blob/master/src/mailgun-transport.js#L83

Would you like to send a pull request with that feature please?

I just might if I find how to do it with mailgun APIs :) For fast fix I just changed our app to use smtp transport with mailgun smtp server to get mails going correctly.

Yeah looks like it is enough to write nodemailer's attachment.cid attribute to mailgun's attachment.inline (https://documentation.mailgun.com/user_manual.html#sending-via-api). I couldn't find if setting Content-Disposition value explicitly is possible at all.

Looks like tests are never even running the code, which converts nodemailer attachment to mailgun one.. (I added debug prints to code, which were never executed).

So fixing this will take some more tIme... If it is ok I'll add also code coverage for test run to see a bit easier which part were actually executed by tests.

Aaand, yeah mailgun-js doesn't support setting inline attribute for attachment... so before this can be fixed mailgun-js issue mailgun/mailgun-js-boland#103 must be resolved first.

Is it likely that is I cannot embed images in the mail? (Only attachment)

Fixed ?

@orliesaurus looks like it was implemented in by #45, as far as I can see implementation did seem correct. Pull request didn't have tests so it might work or might not.

👍

Thanks!