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

Adding an attachment to a message #3026

Closed
thannaske opened this issue Mar 8, 2022 · 1 comment
Closed

Adding an attachment to a message #3026

thannaske opened this issue Mar 8, 2022 · 1 comment

Comments

@thannaske
Copy link

Is your feature request related to a problem? Please describe.
Under specific conditions I want to add an attachment to an e-mail message. I'm currently working on a plugin that does some GPG magic under the hood and I therefore need to add public keys to a message. While playing with the add_body_filter method I realized that this filter is applied for every MIME-part of the message and thus can not be used to add another attachment to the e-mail.

Describe the solution you'd like
Would be great to have a function available for plugin development that allows adding an attachment. I'm no JavaScript/NodeJS expert by any means but I would love to see something like this:

exports.recrypt_enable = function (next, connection) {
    const plugin = this;
    connection.transaction.parse_body = true;

    // Run this under specific conditions
    connection.transaction.add_attachment({
        filename: 'public.asc',
        contentType: 'application/octet-stream',
        content: Buffer.from('...'),
    });

    return next();
}

Describe alternatives you've considered
I tried to use the add_body_filter functionality but unfortunately this method is somewhat restricted because you can not add a whole new MIME attachment to the message body. Furthermore the filtered content needs to be the same encoding and type as before. So no way to add something to the message in here.

Additional context
Would be great if there would be more possibilities to write plugins that can do more with the message body itself. Haraka has a powerful API for working with anything e-mail related but the capacities regarding the message body are somewhat limited.

@msimerson
Copy link
Member

moved to wiki/TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants