Closed LadyAelita closed 1 year ago
Hi @Unelith This is a completely valid issue, thanks for bringing this up, I will have a look at this shortly.
I think the following fix could be simple. Changing the code here: https://github.com/muratgozel/MIMEText/blob/5741465e8594cea8ac5c1287001fc45f344f90f5/src/MIMEMessage.js#L119
From:
const headers = Object.assign({}, moreHeaders, {
'Content-Type': `${type}; charset=UTF-8`,
'Content-Transfer-Encoding': 'base64',
'Content-Disposition': `attachment;filename="${filename}"`
})
To:
const headers = Object.assign({}, {
'Content-Type': `${type}; charset=UTF-8`,
'Content-Transfer-Encoding': 'base64',
'Content-Disposition': `attachment;filename="${filename}"`
}, moreHeaders)
This way you can overwrite headers if you want to and you know what you are doing.
I'm willing to do a PR if this helps as this is blocking some tests I am doing right now.
Hi @nbouvrette this approach looks good, send a PR please 🙏
Sorry I ended up completely changing my approach and no longer use the library so I'll have to pass on the PR at this time.
Closing this issue as of the later versions of this library already supports this.
Sometimes, one wants to have an attachment with
Content-Disposition
set toinline
, so that the files don't show up in the "Attachments" view in the e-mail client. Unfortunately, it's currently hard-coded to only ever beattachment
for attachments. ThemoreHeaders
optional param of.setAttachment()
doesn't help here, because theContent-Disposition
header is overriden anyways.The only way to do it at the moment is as follows:
That's pretty unwieldy, especially when using TypeScript. Is there a chance such functionality could be added?