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

Auto-BCC config option or hook #563

Closed
joeda opened this issue Feb 16, 2013 · 3 comments
Closed

Auto-BCC config option or hook #563

joeda opened this issue Feb 16, 2013 · 3 comments
Milestone

Comments

@joeda
Copy link

joeda commented Feb 16, 2013

Auto-BCC means automatically adding an email-address to the BCC field when you send a mail from a certain address.

At the moment, I don't see a way of configuring alot to do this. Whether alot needs to add an address to fulfill the Auto-BCC condition should be evaluated in envelope mode, since it's agnostic of whether the mail composed is a reply, forwarded or even completely new and therefore you don't need to cover all of the possibilities of writing an email. Unfortunately, it seems to me that it not possible to access the contents of the header fields. The only part of the alot API that is exposed is the database which doesn't contain the mail yet and the UI which also doesn't help, since the the EnvelopeBuffer does not make the addresses in the header field accessible.

Do you have any ideas of how a hook could be implemented? Or is the Auto-BCC-"ability" worth a feature?

@pazz
Copy link
Owner

pazz commented Feb 17, 2013

We could add a 'post-open-envelope-buffer' hook..
You can access the headers of the currently composed mail via the alot.db.envelope.Envelope object at ui.current_buffer.envelope.
Envelopes should behave just like dicts.

@pazz
Copy link
Owner

pazz commented Feb 17, 2013

check out branch https://github.com/pazz/alot/tree/0.3.3-feature-hooks-563, this introduces mentioned hooks.
you can fumble around with post_buffer_open hook, checking if parameter buf is instanceof EnvelopeBuffer,
and read/set its headers accordingly..

@joeda
Copy link
Author

joeda commented Feb 18, 2013

Thanks for your quick reply. I wrote a function to implement the Auto-BCC-feature:

def pre_envelope_send(ui, dbm):                                                 
        ADDR = "some@mail.com"                                   
        BCC_ADDR = "mail@example.org"                               
        from_fulladdr = ui.current_buffer.envelope.get_all("From")[0]           
        if ADDR in from_fulladdr:                                               
                ui.current_buffer.envelope.add("Bcc:", BCC_ADDR)

I'll have a look on the new hook once I figured out how to use github. The post_buffer_open hook is obviously a much better way of doing this, so thanks for that.

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

No branches or pull requests

2 participants