Can an IMAP client automatically filter messages that an IMAP server receives? - email

Let's suppose I have created an IMAP client and I want to create a filter that, say, deletes messages that have certain characteristics.
I can make this a startup task that happens whenever the client is opened, but the problen is that a user might view the inbox in a different client and the filter won't get rid of the unwanted messages before the inbox is viewed.
Is there some way to tell the server to call my service every time it receives a message so the unwanted messages can go away once the server receives them instead of once a client is opened? Is this even possible with IMAP? If not, is there a different well supported e-mail technology that allows this sort of interaction?

You can do server-side email filtering with the Sieve Email Filtering Language and the ManageSieve Protocol. There is good support in open-source software. However, I am only aware of a few major email providers, that support it. If it is supported, it is usually accessible on the IMAP host and with the IMAP account credentials, i.e. you can test it by connecting to TCP port 2000 and 4190.
See the following three links for more information:
http://en.wikipedia.org/wiki/Sieve_%28mail_filtering_language%29
https://www.rfc-editor.org/rfc/rfc5228 (Sieve: An Email Filtering Language)
https://www.rfc-editor.org/rfc/rfc5804 (ManageSieve Protocol)
Sieve also supports a few notifications types. If the filtering language is not powerful enough to for your purposes, you can send notifications for all incoming emails, wake up the IMAP client, and let the client to the filtering.

Related

SMTP server sending rate guidelines

I am build a tool that initiates an SMTP transaction with a domain to see if (a) that domain can receive emails and (b) the desired address exists on that domain. I will be batching large groups of email addresses (10,000+ at a time), but I don't want to bombard the server and get blacklisted. Are there guidelines for how often is it safe to communicate with an SMTP server?
I know about the VRFY command, but it is not implemented across the board. I plan to attempt to use the VRFY command and fall back to using,
MAIL From:<user#example.com>
RCPT To:<first.last#example.org>
QUIT
to see if the message will be deliverable. Again, are there guidelines on how often I can initiate an SMTP transaction like this on a domain?
Edit:
The purpose of this is to create a tool that my organization can use to (a) clean some bad emails from several largely inactive lists so that we do not have to pay our email delivery system to send potentially thousands of emails that will bounce, and (b) check an email when a user subscribes to a list so that we reject emails like aoghuifdgsiuvb#gmail.com.
First of all, spamming is bad. Always ask user wheter she wants to receive newsletters.
"Unsort" mail addresses by domain, leaving the "distance" between e-mail addresses with same domain as big possible.
I think it's not the programmer's decision. There should be a config value which tells a minimum amount of time between two mail sending to the same domain. You should set up a limit also for that config value, avoid setting it to zero or low value.
The only universal guideline I believe can be offered is "don't do this". If you behave like a spammer, you will be treated like a spammer. In the optimistic scenario, sites will already have controls in place, and silently throttle or block you. In less ideal scenarios, they will initiate actions against you on the (reasonable) assumption that you are collecting addresses for a spam list.
A better soluton would be to actually follow through the whole SMTP session, sending a user an email with a verification code/link. This has the advantage of showing that the user actually has control of the address in question and it keeps you from looking like a spam bot.
Volume is not as much the issue as reputation. Let the user know you're about to send them an email in your web flow. This means they're much less likely to mark it as spam.
some hosts have clear and defined guidelines as to how many emails can be sent per hour.
So i guess this would depned onyour hostng service provider, UNLESS your hosting your own mail server off course.

Does POP3 distinguishes between read and unread messages

I am working with Perl and using Net::POP3...
My code is able to get all the mails however I could not find any method in the documentation that can distinguish between read and unread messages.
IMAP does that, so I wanted to know if the same applies to POP3?
PS:: ping() method in Net::POP3 is not listed as capability of Net::POP3
With POP3 it is not possible to distinguish between read or unread. It can only fetch and delete messages. All messages that have not been fetched by the client (which remembers that itself) are regarded as not new by the client if it fetches new messages. The server doesn't care about the state of a message. It just gives you all the messages it has.
From Wikipedia:
POP supports simple download-and-delete requirements for access to
remote mailboxes (termed maildrop in the POP RFC's).[3] Although most
POP clients have an option to leave mail on server after download,
e-mail clients using POP generally connect, retrieve all messages,
store them on the user's PC as new messages, delete them from the
server, and then disconnect. Other protocols, notably IMAP, (Internet
Message Access Protocol) provide more complete and complex remote
access to typical mailbox operations.

Programmable/scriptable mail server

I have the following scenario:
Users send email messages to the special mail addresses (each address is associated with a user).
When the message arrives to the server I need to extract a certain information from the message body and store it in the database.
I am looking for a mail server (or client) that matches following conditions:
Free/open-source
Users/inboxes can be created/deleted via some API on the fly
Works in unix/mac environment (Ubuntu/MacOS X in my case)
Allows me to set up hooks on message queue (via API or receive the data via some I/O channel)
Has good performance and/or scalability potential
Does not have a dependency on Java or other heavy framework.
Note that I do not need a full-fledged mail server i.e. all I need is messages processing.
Finally, I decided to use http://mailgun.net/ service which provides exactly what I need

How to receive emails of the same inbox from multiple server instances

I have an application running on WebLogic Server with 6 instances. Many requests for the application come from Email. We already set up an email account that will be used by all clients to send email to. But the problem is that the email account inbox can only be opened for reading by a single connection, unlike a typical database.
Currently I can only deploy the email reading service on a single server instance, this will effectively create a single point of failure and unbalanced load. What's the best way to read from the same inbox from multiple servers? I am thinking developing something using a database table, sort of leasing, whoever locked the table own the lease and can connect to the email server, but this is pretty hard to implement correctly in all circumstances.
I am not sure why you say that only one client can access the inbox as POP certainly can handle multiple connections to the same inbox and this can be configured in the mail server. You might need to talk to your mail server admin.
I haven't worked with Weblogic to give you a specific answer, but you should also be able to have a service written that checks the incoming mail and process incoming mails into a database as you wanted. Once the information is in a database, you can use it via multiple hosts. This is a better approach as this can be setup to prevent multiple clients responding to the same email.

Coldfusion : Listening to the Email messages

I am trying to have a kind of observer pattern in ColdFusion
We want to listen to the incoming Email messages and act on them. Scenario is something like this :
Application sends email to the helpdesk system
Helpdesk system automatically generates a ticket and responds with an email to the email address of the application
The application's email is configured in the Lotus notes
Now the application should listen to this incoming email message, decode that and update the coressponding ticketid
I see there is a possibility with Event Gateways, but I am unable to realize the whole picture.
Thoughts or suggestions?
One way is to setup an email server with IMAP support, and use some sort of polling (every minute, good enough?) in CF using <cfimap> to get the emails.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WS371453EC-36D5-44ce-BF1E-750E3016BBD6.html
We have a system like this.
We have a postfix server configured to handle mail for a domain. A small script (Perl) on the postfix server places each email on an ActiveMQ queue.
We have a cluster of CF boxes with the ActiveMQ event gateway listener that takes the messages off the queue and processes them using Java Mail.
The delay between postfix receiving the email and a CF server processing it is generally under 1s.
We needed to do it this way for a number of reasons, processing delay being one of them, dealing with a large cluster of CF which made the POP/IMAP solution complicated, and CF's mail handling not being quite what we wanted were others.
It works great.
I've created similar applications in the past using cfpop to interogate a mailbox on a scheduled basis.
It was pretty easy to write, but usually gets thrown for a loop when "users" start being "helpful" with the email content.
The other thing is that this isn't instantaneous, but is the process really time critical to the second?