[imp] Generating a Compose message (with content) via script

Robin Bankhead horde at headbank.co.uk
Tue Dec 31 16:53:42 UTC 2013


Quoting Michael M Slusarz <slusarz at horde.org>:

> Quoting Robin Bankhead <horde at headbank.co.uk>:
>
>> Hi,
>>
>> I was thinking about trying to integrate some IMP actions into our  
>> existing intranet app, and have a couple of enquiries as to whether  
>> this is feasible.
>>
>> We already use a full horde-webmail install (using auto-login)  
>> under the same server (at /horde/ via an Apache alias) but the two  
>> do not currently interact.
>>
>> What I would like to be able to do would be to generate a message  
>> body within our own app and send it to IMP, then opening it in a  
>> Compose window.  This won't work with a mailto: link because the  
>> body is too long for the URI limit in some cases.
>>
>> So my questions are:
>>
>> 1. Is it actually possible to feed the whole message body (plus  
>> recipient header) to IMP via script in this manner?
>
> Not as of now.  This is intentional to prevent abuses of the compose  
> sending process.
>
> And I don't really see any need to add this functionality to the  
> compose pages.  it might be useful to add an externally-accessible  
> service that allows mail to be sent via the IMP mailer  
> configuration.  But this would be an independent action ... and also  
> doesn't currently exist.
>
> michael
>

Happy to report I found a lo-fi solution to this.  I open the window  
using javascript, send the form to that window, then once loaded, call  
DimpCompose.setMessageText() on the opened window to inject the body  
text.

I haven't tested this part yet, but it looks like I can do the same as  
a reply by adding the appropriate "type", "mailbox" and "buid"  
parameters to the posting (mailbox can be hardcoded in our app, buid  
can be retrieved by normal IMAP methods).

Just thought I should document this in case anyone else happens along  
with a similar use-case.

Thanks again,
Robin Bankhead



More information about the imp mailing list