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.
Related
My goal is to develop an Exchange listener that will intercept the organization mail box for new mails and for each mail it would do some logic.
After i've researched the subject online - i saw that there are two primary ways to do that:
Configure a new MTA (Mail Transfer Agent) that will be situated before the exchange server and will intercept the SMTP messages.
Use EWS API to subscribe to a new mail event and run the login on the listener
in this way i have 2 basic problems:
Is there a way to subscribe to all mailboxes on the exchange server? without looping all the users ?
How i can block a client to read his email before my listener handled it ? (can i move the whole incoming mail to a special default folder that the users wouldn't have an access to it - some king of hidden folder ?
Is there other way besides the two that i mentioned to fulfill the demand ?
Thanks!
You can use a Transport Agent on Exchange https://technet.microsoft.com/en-us/library/bb125012(v=exchg.150).aspx which allows you to capture/proces messages while they are in the Transport pipeline. The advantage of this over what you have described in 1. is that you capture every message sent/received on the server including internal messages.
Is there a way to subscribe to all mailboxes on the exchange server? without looping all the users ?
No you need to managed your subscriptions per mailbox folder
How i can block a client to read his email before my listener handled it ? (can i move the whole incoming mail to a special default folder that the users wouldn't have an access to it - some king of hidden folder ?
All clients are equal on Exchange so you cant prioritise a client or block access to a new messages (you can block the client entirely) , in theory you could move all messages that arrive to NON_IPM_Root folder with an Inbox rule which means the user couldn't see them but you might want to consider the implications of what happens when your process fails, this could also be disabled by the user at any time when they create a Inbox rule themselves.
I'm wondering how (official) GTalk clients manage to show all messages received - even if it was originally consumed by another client. For example: I'm logged into GTalk on gmail.com on my laptop and, at the same time, via the official GTalk app on my Android device. A friend sends me a message, which is displayed on both the gmail.com client and the Android client. (I think it's originally only forwarded to one of either clients, but the second client fetches the message later on)
I recently found out that there's a very similar XMPP feature, called Carbons. However, after a quick service discovery request Google's servers didn't advertise this feature. XEP-0313 and XEP-0136 look good too, but the servers don't advertise them either.
Possibly related question: Deliver Google Talk message to all logged in clients using XMPPPY
When you initiate a new chat then you should send the first message to the users bare Jid. This is what most clients are doing. When the GTalk server retrieves a chat message to a bare Jid it routes the message to all available resources. For all following messages in this conversation the clients normally pick up the Resource and send them to full Jids. The messages should not be replicated then.
Many other servers don't route message to bare Jids to all resources, but to the most available resource which is the client with the highest priority.
Here is a quote form the RFC:
If there is more than one resource with a non-negative presence priority then the
server MUST either
(a) deliver the message to the "most available" resource or
resources (according to the server's implementation-specific algorithm, e.g., treating
the resource or resources with the highest presence priority as "most available") or
(b) deliver the message to all of the non-negative resources.
XEP-0280 defines this. As I understand, it defines the mechanism to notify all the resources from same user when one of them sends a message to anyone. I mean, Alice/pda sends a message to Bob, so Alice/mobile and Alice/PC will receive a copy of the message sent be Alice/pda.
Hope it helps. I am currently looking for a server that implements this, and also for a client library. If not, I will implement it by myself in both jabberd2 and gloox xmpp library.
Cheers,
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.
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
I am basically writing a XMPP client to automatically reply to "specific" chat messages.
My setup is like this:
I have pidgin running on my machine configured to run with an account x#xyz.com.
I have my own jabber client configured to run with the same account x#xyz.com.
There could be other XMPP clients .
Here is my requirement:
I am trying to automate certain kind of messages that I receive on gtalk. So whenever I receive a specific message eg: "How are you" , my own XMPP client should reply automatically with say "fine". How are you". All messages sent (before and after my client replies) to x#xyz.com but should be received by all clients (my own client does not have a UI and can only respond to specific messages.).
Now I have already coded my client to reply automatically. This works fine. But the problem I am facing is that as soon as I reply (I use the smack library), all subsequent messages that are sent to x#xyz.com are received only by my XMPP client. This is obviously a problem as my own client is quite dump and does not have a UI, so I don't get to see the rest of the messages sent to me, thereby making me "lose" messages.
I have observed the same behavior with other XMPP clients as well. Now the question is, is this is a requirement of XMPP (I am sorry but I haven't read XMPP protocol too well). Is it possible to code an XMPP client to send a reply to a user and still be able to receive all subsequent messages in all clients currently listening for messages? Making my client a full fledged XMPP client is a solution, but I don't want to go that route.
I hope my question is clear.
You may have to set a negative presence priority for your bot..
First thing to know is that in XMPP protocol every client is supposed to have a full JID. This is a bare JID - in your case x#xyz.com with a resource in the end e.g. x#xyz.com/pidgin or x#xyz.com/home (where /pidgin and /home are the resource). This is a part of how routing messages to different clients is supposed to be achieved.
Then there are the presence stanzas. When going online a client usually sends a presence stanza to the server. This informs about e.g. if the client is available for chat or away for lunch. Along with this information can be sent a priority. When there are more than one clients connected the one with the highest priority will receive the messages sent to the bare JID (e.g. ClientA(prio=50) and ClientB(prio=60) -> ClientB receives the messages sent to x#xyz.com). But there are also negative priorities. A priority less than 0 states that this client should never be sent any messages. Such a stanza might look like this
<presence from="x#xyz.com/bot">
<priority>-1</priority>
</presence>
This may fit your case. Please keep in mind it also depends on the XMPP server where your account is located, which may or may have not fully implemented this part of the protocol.
So to summarize: I recommend you to look through the Smack API how to set a presence and set the priority to <0 for your bot client right after it connected.