want to monitor new mails with different account imap credential - node.js

I'm implementing an Email Client Application to monitor new email arrival for different IMAP configuration simultaneously. I preferred Nodejs, but I stuck up with connection creation.
Let me explain with following example:
I have 3 IMAP configurations (it's not restricted to 3, each provider may have 10, 100, 1000 or > 1000 users).
Gmail
Yahoo!
Hotmail.
I did the configuration for these 3 providers. Now I want to monitor above 3 mail servers for different users. Let's say Gmail with 1000 different users, Yahoo! with other 1000 users and Hotmail with 1000 users.
My question is I want to monitor new email arrival for every user with every mailbox.
Will NodeJS be helpful to do this? It's going to create many TCP connections.
I want to implement this with less network cost.

Similar to this question:
Why can't I login to an imap server twice in Python
What you are expecting IMAP to do cannot be done. When you connect to
an IMAP server you issue a LOGIN, do some stuff, then eventually give
a LOGOUT. After the LOGOUT you cannot do another LOGIN.
So whatever IMAP library you use will have to generate a TCP socket
connection for each mailbox you check. With that said Node.js has
some pretty easy-to-use IMAP modules:
https://github.com/andris9/inbox - Easy checking of inboxes
https://github.com/mscdex/node-imap - More low-level IMAP stuff

Related

can I send an email through a PHP mailer with my localhost without Gmail?

can I send an email through a PHP mailer with my localhost without using Gmail? or any other email service like Hotmail, outlook using my localhost?
Yes, and this is actually the best way to send using PHPMailer. There are two things you need:
A hosting provider that permits outbound SMTP. A large number of providers block SMTP by default, but you may find that they will remove the block on request (scaleway.com), provide an alternative service (AWS), which may also be acceptable.
A locally installed mail server. If you're on Linux, something like postfix is a good choice.
The way it then works is this:
Write your PHPMailer script as normal, but delivering to localhost over SMTP (not via mail())
Configure your mail server to act as a "full" mail server, where it attempts to deliver messages directly, or to act as a "smarthost" to relay through some other service, such as gmail or mailgun.
The main advantages of this approach are:
Perceived performance: your message submissions will appear to be instant, so it's great for things like contact forms
Reliability: if your message can't be delivered immediately, the local mail server will automatically take care of queuing and redelivery attempts, in a way that is far more efficient than you would ever achieve if you handled that within your own application.
As with many things, with great power comes great responsibility, and you will have to deal with bounce handling, blacklisting, inbound filtering (or just block it), etc. It's probably not worth doing all this for a simple contact form, but if you have an application that generates a reasonable amount of email traffic (signups, password resets, notifications, etc), it's a great way to go.

Accessing GMail with GMail client and JavaMail (via pop3)

I've written a JavaMail client to access a GMail account via POP3.
As expected, I can only read a message once. When I re-run the client, the message is not found as it has been deleted from the server.
However, when I then log onto the GMail account (IMAP enabled) via a browser, the message appears.
Why does this happen? Are separate copies of the email created for POP3 and IMAP?
POP3 clients access the inbox, and what they see is unseen mail. When the POP3 client has seen a message it's no longer unseen and the POP3 server is supposed to do something.
The gmail server probably moves the message to the Archived folder.
You may have won a prize as the last person to have written a POP3 client, BTW.
Gmail has specific special handling for POP3 account:
In the default mode, it expects a 'download and delete' client. It will only expose 300 or so messages until those are DELEted. They are not actually deleted, but they are removed from the pool of messages to be sent through POP3. This prevents some of the inefficiencies with traditional POP3 clients accessing huge mailboxes, but does allow the client to eventually access everything.
The other mode is recent mode. You can use this mode by putting "recent:" in front of your login, like "recent:bob#gmail.com". This switches it to a mode where it will only show your client the most recent 30 days worth of messages. The messages do not disappear, until they fall out of the window. Again, this limits the size of the message list to a reasonable number for efficiency reasons, but in a different way. However, deletes can be synced between clients. (This may mean archiving in the Google Way). Recent mode is currently documented here in the troubleshooting section I want to download emails on multiple email clients.
Or, you could just use IMAP. Even without using all the additional features of IMAP, you can do everything you can do with POP3, but will allow many other features as your client evolves.

is It possible to Monitor all the mailbox using Nodejs instead of particular MailBox?

I am creating my Own Email Client Application using nodejs.Nodejs will sit between my Client Application and IMAP Server.
I am using node-imap module from Nodejs. It is designed to monitor only one mailbox at a time. But i supposed to monitor all the mailboxes available from IMAP mail Server.
I am using IMAP IDLE concept here. AS per RFC, IDLE only applies to the selected mailbox, thus requiring an additional TCP connection per mailbox. But i want to monitor all the mailboxes without using any additional TCP connection using NOde js Cluster concept simultaneously...
please help me out...
You can't do that. That's what NOTIFY does and I bet the server you're using doesn't support NOTIFY.

Enumerating clients of a 389/Fedora Directory server

I have a Fedora Directory server that I need to shut down. In order to do so, I need to find a list of all clients currently authenticating to this server. Not being familiar with Fedora/389 Directory, I was wondering if there's an easy way to do that? My best option at this point seems to be to comb through the log files.
An LDAP-compliant server should send the unsolicited notification to clients about events transpiring between the client and server. The notification contains information that the client can use to take an action. Therefore, properly coded clients should not care about the server being shutdown. Clients that do not support the unsolicited notification should have that support added.
see also
LDAP: Programming Practices

monitoring an email address

I'm hoping for an event based way to know when I get an email. Right now I'm using gmail but the email host isn't critical. Do I really have to poll it?
You could forward the mail to a *nix host that uses .forward files, then pipe the mail to a script that handles raising the event in your program (by pinging a URL, etc.)
Here's an example in a CPanel/PHP environment: http://kb.siteground.com/article/How_to_pipe_an_email_to_a_PHP_script.html
If you connect to gmail using IMAP, you should be able to use the IDLE command. Gmail's IMAP server does support IDLE.
RFC 5465 proposes a NOTIFY extension to IMAP. It is unlikely that many servers implement it, though.
I've had bad luck with IDLE on both GMAIL and on Dreamhost (which uses courier). Exchange does a great job with IDLE though: I see mailbox updates in less than a second.
Without good IDLE support, yes, you need to poll.

Resources