Example for doveadm-save using Doveadm HTTP API

Aki Tuomi aki.tuomi at dovecot.fi
Thu May 11 09:00:13 EEST 2017



On 11.05.2017 00:36, KT Walrus wrote:
>> On May 10, 2017, at 5:16 PM, Sami Ketola <sami.ketola at dovecot.fi> wrote:
>>
>>
>>> On 10 May 2017, at 16.26, KT Walrus <kevin at my.walr.us> wrote:
>>>> # curl -v -X POST -u doveadm:hellodoveadm -H "Content-Type: application/json" -d '[["save",{"user":"samik","mailbox":"INBOX/myfoldertoo","file":"From: Joulu Pukki <joulu.pukki at korvatunturi.fi>\nSubject: plaa\n\nmail body\n"},"bb"]]' http://localhost:8080/doveadm/v1
>>> Thanks. I worry that by inlining the entire message in the curl command, the message might exceed some limits on how long a command can be. Some of my messages are up to 20MBs with the attachments and 1MB messages are very common. I also worry about the raw message having unescaped quotes in the message messing up to actual storage of the message in the INBOX. Are HTML mail messages encoded to be safe to enclose in quotations? Or, should I encode the entire mail message and trust that Dovecot can handle decoding the message in the back end?
>>
>> The question is: why do you want to deliver 20MB messages with doveadm http api? I would not replace LMTP with that.
> I could certainly end up using SMTP/LMTP, but in my case I need complete control over when, where, and how messages are delivered. The IMAP interface gives me that control, but the Doveadm HTTP API seems easier and I can do operations that span all users with this API. So, I don’t need to worry as much about scaling (since I think IMAP is limited to one user at a time per connection).
>
> If the Doveadm HTTP API isn’t mature enough or have a PHP interface (like Roundcube gives me for IMAP), I may have to just go with IMAP or SMTP. SMTP is a whole lot easier from PHP of my 3 options, but only handles new message delivery and not the other admin actions I need to do. Eventually, I want to hire some programmers to code my admin app in Go and move to a micro-services architecture, but to start out, when scaling isn’t that important, I’m coding the mail admin app in PHP (since Roundcube Framework gives me a lot of mail handling classes that are mature and well tested).
>
> Kevin

There is no PHP interface. Roundcube is made with php, so it's not
really wonder there is.

The API is mature enough for it's use. doveadm save is not intended for
mail delivery function, it's more about dropping administrative or such
emails to user's box. It will not behave as delivery, that is, you won't
get sieve acting on those. quota is still imposed, though.

There are no size limits in the API, other than imposed by your system.
You can dump 20M email if you want, it will happily consume it.

Aki



More information about the dovecot mailing list