/Deleted flag imap collector - perl

my last question
I write collector for imap (perl). There was a question, if the user marks a message as deleted, what should happen with the message from which I gathered all? Remove it completely, or move in a trash, or create a new archive folder for these messages? If I flagged /Deleted gmail and yandex, for example, removes it completely, my work mail service move letter to trash folder. What is the correct implementation?

It is unclear what you are doing. Presumably, you're working on a program which serves some purpose. What is that purpose?
If you are writing some tool which accesses an IMAP account as a client, then you should not handle any sorts of policies such as "what to do with deleted messages". Some other IMAP client marked that message as \Deleted, and the server decided that it's good to implement IMAP's usual two-phase deleted with \Deleted and EXPUNGE. There are, as you already mentioned, other possible policies where the server might auto-expunge upon seeing the \\Deleted flag getting set, perhaps by moving the e-mail to a virtual Trash folder, etc. As an observer of an IMAP account, though, you are most likely not suppossed to care.

Related

How does an IMAP client choose names to create/use for special folders, because I have 3 "Sent" folders in Outlook

Outlook, IOS and Android clients, as well as the built-in Web-Interface client of this Installation all seem to use different IMAP folder naming schemes.
The current bulk of users on that system use Outlook 2010. As well as the above, I also need to support WP, Thunderbird(Cross-Platform).
Some clients have easy ways to change the folder assignment for (sometimes only some of) the special folders, some I haven't found easy ways yet, and for some I'm unsure of even the possibility.
Outlook here is a special case, as it creates localized folder names (.&AMk-l&AOk-ments envoy&AOk-s means .Éléments envoyés) server-side.
IOS (i think) also does this, but has options to change the foldernames used)
This leads to folder mess in Outlook, if the users have used several mailbox access clients.
Is there some kind of Server-Protocol, or Option I could enable on the client or server (dovecot here) to force usage of "International, short names" server-side (Sent, Trash, Drafts, Junk, Inbox, Infected), and let the client bother with translation to the users regional settings? (Like the "C:\Users\ folder in windows already does it).
Or any other way to force Outlook to not create/use non-english folders?
EDIT: Outlook<2013 has options to move some of the imap folders. Later version support some subset of RFC6154 (XLIST).
But I still have not found, how to change the outlook defaults (policy, reg-key, whatever) for Outlook<2013 and Servers without XLIST.
There is no way in Outlook 2013+ to change the IMAP folders except using RFC 6154 on the server. On Servers without XLIST Outlook 2013 seems to do some "guessing" which often fails. The documentation on how to do this in dovecot is here: http://wiki.dovecot.org/MailboxSettings
This will not help you with existing clients though, since outlook checks this only on the initial connection. You might try outlook.exe /resetfoldernames, but probably removing and re-adding the account is necessary for this to take effect.

Process mail bursts one at a time

we receive bursts of mails from our IDS that we are postprocessing to create incident reports, forward them to request tracker, etc. Right now, we have one script that does all the postprocessing that is called by procmail according to rules in /etc/aliases. Something like:
ids-report: "|/opt/ids/process.pl"
Now, the problem is that running many instances of this script because of mail bursts can lead to memory depletion and some synchronization nastyness.
In my script, I tried using Sys::RunAlone, but found it suboptimal.
I would like procmail to feed my script one mail from queue at a time, but I have not found a way to do it.
Do you guys have any idea, what could I do? Out-of-the-box solutions are welcomed too...
Thanks.
Why not save every mail to a file or database as soon as you receive them and process the saved records one at a time from another script ?
If you post some code you may receive more (and possibly better) answers :)
I second Georgi Rangelov's answer but if you are seriously asking how to run only one message at a time in Procmail, the answer is to use a lock file.
:0:only1.lock
| /opt/ids/process.pl
This means, if the file only1.lock exists, wait. Once it's gone, create it, run the pipe, and then remove the lock file when done.
See also http://porkmail.org/era/procmail/mini-faq.html#locking
"IMAP with idle" mailbox as buffer/pipeline of email messages
You may deliver messages to IMAP mailbox. You can use fetchmail with --idle (to get real time processing) and --mda (to execute your script).
You can make procmail deliver messages to maildir as use dovecot even without daemon running to allow fetchmail access maildir using IMAP protocol.
P.S. I may provide a few more details if you are interested. AFAIR I had used it to handle spams catched by my spamtrap server.

The queue does not exist or you do not have sufficient permissions to perform the operation

When I try to test the queue via the Message Bus. I've checked and permissions are set to full control for everyone. I use 'msmqmng.exe send' from a different machine to put a message onto the queue, it works and is absolutely the message I sent. So what other moving parts might I be missing???
I spent couple of days banging my head for this error, and the root cause was that the storage quota for MSMQ was exceeded! which doesn't seem related to the error message, which makes it a difficult cause to detect...
When sending a message to MSMQ, the sender server will use an outgoing queue located on the sender side, and this outgoing queue is using the storage on that sender server.
The MSMQ component has a maximum quota, defined in the MSMQ properties, and when this quota is exceeded, the above error message starts popping (that's why when you sent from another machine, it worked correctly, since the issue is with the sender not the receiver).
Resolution:
To change this quota, right click on Message Queuing (from Computer management if using Windows server 2003 for example) then properties... (I cannot post images since i am a new user), but in the properties window, you will find in the first tab an editable storage limit field.
To check the currently used storage on the server, open the path of the storage, and check its size: (open the storage tab in the same properties window, and get the path of the storage folder)
If the size of the quota is similar to the size of the storage folder, then this is the root cause of your issue.
If you dont have permission to increase this quota limit, you should have your user added to the "Security" tab in the message queuing properties window.
Hope this helps...
Please vote up if you agree in order for me to have some points and post images in my next answer... :-)
Setting up the queue in Server Manager, Message Queueing I neglected to add the data source name to the queue name. (queue_name_dsNAme) So from one side I was able to insert messages. However, from the Server Group, Message Bus, it automatically appends the data source to the queue to be tested. So, the queue really did not exist.
Turns out there's another twist... even after the naming convention was sorted out there was an application that knew of the queue and was reading from it. When the test message was sent the app grabbed it before the test mechanism had a chance to receive it back, which caused the timeouts. By enabling journaling the message gets put there and you can see what went through the queue. While all this may seem obvious... it pays to ask stupid questions.

Coldfusion 9, How do you Empty an "Undelivered Mail Queue"

I have roughly 9,000 undelivered messages in my mail spool in Coldfusion 9. As far as I can tell the only way to manage these messages is to manipulate them 10 at a time through the CF Admin GUI.
I'm looking for a way to expedite this process. I'd like to just clear the queue, or batch send them all.
Does anyone know how to do this?
Thank you,
-Dave
Go into the filesystem and move the files from cfusion/mail/undelivr to cfusion/mail/spool. Simple!
Take a look at Ray Camden's SpoolMail (http://spoolmail.riaforge.org/). This is a very handy plug-in that you can add to all your servers and at bulk move your emails to spool and resend them.
Someone sent me a snippet at some point that would try to reprocess the queue periodically at some point, but for the life of me, I can;t find it or see it on google. - sorry.
HOWEVER: the undeliverable queue is just a bunch of files, you can write yourself a little application that will try to reprocess the queue periodically and prune out the ones that have been in the undeliverable too long.
I am pretty sure that the spool only tries to deliver mail once
just move the files back into the spool directory to have the spooler "retry"
you would have to keep a file or DB to track what has been tried & how many times.
I would also send a notification on what has been deleted - or at least log it.
-sean
PS> 9000? what is your traffic like? I would suspect there is a problem if you have that many undeliverables....
You should write simple CF program for tracking and deleting for undelivered mails.
Use cfdirectory tag.
If you moved your mail server and the spool doesn't seem to ever empty out, you need to open up each .cfmail file and change the IP number. I moved my mail server as well, and when I brought it back up I had forgotten to change the IP setting for mail in CF Admin, and wound up with 21,000 emails in my spool by the next day. Ugh. I could have run a cf script on it to open up each one, change the IP number, and then move the file into the spool dir, but opted instead of downloading a free search and replace utility from download dot com. Worked like a charm. It took about twenty minutes to do the full s&r and then a few seconds to move them all over.
The file system is the simplest way.
To attempt to resend the emails, move the files in ~\ColdFusion2016\cfusion\Mail\Undelivr to ~\ColdFusion2016\cfusion\Mail\Spool.
If you just don't care about those email files then simply delete them.
I point my development mail server to point to nowhere (smtp.gmail.com.dontSend) so no mail goes out and they all just stack up in undelivered. That way the rest of my development team does not get all the errors I generate and catch through email. More importantly, no test emails accidentally go out to real accounts.
I go into the CF-Administrator to look at and manage my undelivered mail when testing but if/when it gets huge I just delete them from the file system.

How auto-subscribe on new IMAP folders in Gnus?

I need automatically subscribe on new IMAP folders created by my IMAP server in Gnus. How to do this?
You could fix the value of gnus-auto-subscribed-groups so that it includes the nnimap backend as well as the other mail backends. You might run into difficulties if your IMAP server does something funny like present all of your home directory as mailboxes (think I'm joking? try uw-imapd); then maybe setting nnimap-list-pattern will help.
Oh, and if you don't see your newly subscribed groups, it could be because Gnus auto-subscribes groups at the zombie level, meaning that they are not really very subscribed. Fix that by setting gnus-subscribe-newsgroup-method. Gnus is like that; you really can't avoid studying the manual.