Cache unseen count

2016-02-10 Thread Jorge Carling
Dear all,
Lately I am working on PHP mail account management application. It has, among 
others, Unread messages count column.
To get the number of unread messages, I execute "doveadm search" command for 
each database row.
The search time for single account is about 0.03 seconds. Our system has around 
750 accounts, so the total loading time is currently around 20 seconds.
When setting up Dovecot, I made the user_query, which is also used to store the 
message quota, and total number of messages stored in particular mailbox.
Is there a keyword that can be included in the user_query, or some other way to 
maintain the unread messages count in the database? Maybe there is a way to 
execute a script every time a message is received, or becomes read, or unread.
Kind regards,JC   

Re: user password in mail-filter plugin

2016-02-10 Thread @bitkomplex
Am 05.02.2016 um 11:31 schrieb Thomas Möhle:
> Am 05.02.2016 um 10:38 schrieb Timo Sirainen:
>>
>>> On 05 Feb 2016, at 00:54, Thomas Möhle  wrote:
>>>
>>> Unfortunately it still doesn't work. The filter-script does not recieve
>>> any data from that variable.
>>> I tried replacing the %w with %u, to see, if the filter-script would at
>>> least recieve the username then, but that doesn't work, either. So I'm
>>> not sure, if %{userdb:pass} isn't read correctly, or if "override_fields
>>> = userdb_pass=%w" doesn't set it right.
>>
>> Check with:
>>
>> doveadm auth login user@domain password
>>
>> In the output there's supposed to be the "pass" field in userdb extra 
>> fields. If not, try adding before your first userdb:
>>
>> userdb {
>>   driver = prefetch
>>   result_success = continue
>> }
>>
>> I don't think that was supposed to be necessary though.
>>
> 
> Still nothing. It seems like the extra field doesn't even exist. :/
> 
> doveadm auth login tho...@example.com mypassword
> passdb: tho...@example.com auth succeeded
> userdb extra fields:
>   tho...@example.com
>   home=/var/mail/example.com/thomas
>   mail=maildir:/var/mail/example.com/thomas/mail:LAYOUT=fs
>   quota_rule=*:bytes=0
>   uid=5000
>   gid=5000
> 

I'm still stuck on this issue. What can I do, if "override_fields =
userdb_pass=%u" sets the field to the username? Is it possible, that
this is a bug in v2.2.21?


Re: Question on setting up dovecot

2016-02-10 Thread Joseph Tam

Jeffery Small writes:


I'm new to dovecot and have a configuration question.  I'm attempting to
have a Windows 7 system on my secure LAN connect to the Ubuntu server
using POP3 on channel 110 and retrieve mail from the /var/mail directory.
The user is defined on the Ubuntu machine and when running the Windows
Internet E-Mail Settings tool, the Test Account Settings Logs onto the
server successfully and sends a test message.


Sending message is a distinct service from retrieving Email.


However, when I perform a
Send/Receive operation from the user's Outlook, all steps complete but no
mail is pulled down from the server.

I have tried setting:  mail_location = /var/mail/%u

and restarted dovecot, but nothing changes.  How can I debug this?  I'm
unsure where to look for clues as to what's happening under the hood.  Any
pointers would be appreciated.


Log files would be a good start.  Maybe start with something like

log_path = /path/to/logfile
auth_verbose = yes
auth_debug = yes
mail_debug = yes
verbose_ssl = yes

Joseph Tam 


Pigeonhole Sieve fails on date-based filter rules - bug?

2016-02-10 Thread Clemens Ender
Hi list!

I’m running dovecot + pigeonhole on a debian wheezy based VPS.

Here is the output of „dovecot -n“

# 2.2.18: /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.8 (0c4ae064f307+)
# OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.9 
disable_plaintext_auth = no
imap_idle_notify_interval = 29 mins
mail_plugins = acl quota fts fts_lucene
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character 
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy 
include variables body enotify environment mailbox date index ihave duplicate
namespace {
  location = maildir:%%h/maildir:INDEX=~/maildir/shared/%%u
  prefix = shared/%%u/
  separator = /
  type = shared
}
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
special_use = \Drafts
  }
  mailbox Junk {
special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbox Trash {
special_use = \Trash
  }
  prefix = 
  separator = /
}
passdb {
  args = username_format=%u /home/dovecot/auth.d/%d/users
  driver = passwd-file
}
plugin {
  acl_shared_dict = file:/home/dovecot/vmail/%d/shared-mailboxes.db
  fts = lucene
  fts_autoindex = yes
  fts_decoder = decode2text
  fts_lucene = whitespace_chars=@
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
}
protocols = imap pop3 lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
  }
  unix_listener auth-userdb {
group = vmail
mode = 0600
user = vmail
  }
}
service decode2text {
  executable = script /usr/local/libexec/dovecot/decode2text.sh
  unix_listener decode2text {
mode = 0666
  }
  user = dovecot
}
service lmtp {
  executable = lmtp -L
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
port = 4190
  }
}
ssl_cert = > Filtering message:

  ID:  <0.0.6.888.1cfaff845d5e634.77...@mta144.avaaz.org>
  Date:
  Size:17781 bytes
  Subject: =?utf-8?q?Klimafreunde_-_der_Plan_ste...

Performed actions:

 * store message in folder: Archiv/2014

Implicit keep:

  (none)

>> Filtering message:

  ID:  <1527093595.86163601420098718229.javamail.em...@email.apple.com>
  Date:Thu, 1 Jan 2015 07:51:58 + (GMT)
  Size:19573 bytes
  Subject: =?ISO-8859-1?Q?Ihre_Rechnung,_Nr.=A01...

Performed actions:

  (none)

Implicit keep:

 * store message in folder: INBOX

...


So it appears that the „Date“ header is not properly extracted for the affected 
emails.

Here are the headers of an particular email (the one without „Date:“ listed 
above):

Return-Path: 
Delivered-To: 
Received: from vps1.en-der.at
by vps1 (Dovecot) with LMTP id Vrb9JNSl31M5aQAAwqatwA
for ; Mon, 04 Aug 2014 15:25:08 +
Received: from mta144.avaaz.org (mta144.avaaz.org [69.60.9.144])
by vps1.en-der.at (Postfix) with ESMTP id 61715ACDAA
for ; Mon,  4 Aug 2014 15:25:07 + (UTC)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; s=av_key; d=avaaz.org;
 h=Content-Type:MIME-Version:Subject:From:To:List-Unsubscribe:Message-ID; 
i=av...@avaaz.org;
 bh=aNrRG1oOw57rU4AT/0miGg8aWAI=;
 b=erOsRngaWCaW7R0sK8COa4k97QpCISFa6/0ZKfZJHAEHKJu3FbUTExJb/L6OQez/V26UgwpbKJqU
   Py0l8dDpu68tUlhR42AUnZV+M+lpqI6LdoiTt/QMC0TklQnqdKZt0E4CG+Kz7plluYwhXlZHVSXc
   +apdPqllFZeYAcsaN5k=
DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=av_key; d=avaaz.org;
 b=YdIs06lkIN6pxGKoLORIDjbBCLU/5vwP1QCVocIa0qB4EgT1uKwf+bDlpbQVWmSsjPzekeZmWbpZ
   um+paKzqq7UGtJMVb1eGjod/bkuOGeXXdeZG0tGJz8wfLdNog6DbfChRBvMciS/Wsz+xrK3yVbX6
   bQuKbeD/gurWPhEDfFc=;
Received: by mta144.avaaz.org id hruita1u62ku for ; Mon, 4 
Aug 2014 11:25:07 -0400 (envelope-from 
)
Content-Type: multipart/alternative;
 boundary="===1522543492113580631=="
MIME-Version: 1.0
Subject: =?utf-8?q?Klimafreunde_-_der_Plan_steht!?=
From: Ricken Patel - Avaaz.org 
To: "clem...@en-der.at" 
List-Unsubscribe: 

X-Campaign-ID: avaazCLIMATEeventhostsrecruitment201407301851073204
X-Version-ID: 43375
Message-ID: <0.0.6.888.1cfaff845d5e634.77...@mta144.avaaz.org>

--===1522543492113580631==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Liebe alle,

tausende von uns haben
...

Any idea what is wrong here?

Best regards,
  Clemens Ender

smime.p7s
Description: S/MIME cryptographic signature


Re: RFC: HTTP based storage API

2016-02-10 Thread David Niklas
On 08 Feb 2016, at 11:01, Nagy, Attila  wrote:  
> Nearly every popular programming language has an LMTP/POP/IMAP
> implementation, most of them suck in many different ways.
> I don't know any server or library which provides a well-established,
> compatible protocol frontend with an open backend API, which could be
> used to easily make a custom storage backend for the LMTP/POP/IMAP
> frontend in any language, in any programming paradigm, irregardless
> of the frontend implementation.

Sorry to come in late, but as a curl lover I'd like to know what is wrong
with their implementation of pop3 and imap (project homepage
curl.haxx.se).

Thanks, David


Re: Sieve question

2016-02-10 Thread @lbutlr
On Feb 10, 2016, at 12:18 AM, A.L.E.C  wrote:
> require ["copy"]
> if header :contains “from” “t...@example.com” {
>   redirect :copy “us...@example.com”;
>   redirect “us...@example.com”;
> }



Ah, right, that makes sense. Thanks.

-- 
Honesty may be the best policy, but insanity is a better defense.


Re: Sieve question

2016-02-10 Thread Stephan Bosch



Op 10-2-2016 om 10:30 schreef @lbutlr:

On Feb 10, 2016, at 12:18 AM, A.L.E.C  wrote:

require ["copy"]
if header :contains “from” “t...@example.com” {
   redirect :copy “us...@example.com”;
   redirect “us...@example.com”;
}



Ah, right, that makes sense. Thanks.


The copy extension is not needed here. The redirect action is explicit 
and will not be affected by cancellation of the implicit keep in the 
absence of ":copy".


Just keep in mind that the total number of redirects is limited (subject 
to configuration).


Regards,

Stephan.