How to retrieve LASTEST emails from a POP3 Server? - vb.net

I was recently working on a project that involving connection to a POP3 Server. I was using this piece of C# from CodeProject(http://www.codeproject.com/Articles/6062/A-POP3-Client-in-C-NET), had complied it into a DLL and was using it in VB.NET.
I'd connected to my Hotmail Account (not many mails) and it seems to work just fine. After that, I connected to my GMail account... I started seeing errors!
POP3 is meant to fetch emails only from the Inbox. Even when I made my own program to cross-check the problem, I saw that when I requested for the number of messages, the GMail POP3 Server returned a value which is about 5 times less than the actual inbox size.
255 Emails in my Inbox?? Online it shows me 2,414 emails in my Inbox.
And secondly, my MAIN QUESTION is that how does one fetch the LATEST email from the POP3 Mailbox. What I've fetched here was an e-mail with ID 1! I want to fetch the top 20 emails (that were most recently delivered to the account)...
Is there any work around for how to fetch the LATEST email from the POP3 Server rather than the oldest emails? I've also tried to connect to the Hotmail POP3 Mail Server. Again a "RETR 1" command fetches me the oldest email and not the latest one! Any known work-around?

I think your question is answered here: "Incorrect message count using STAT command" http://groups.google.com/group/Gmail-Help-POP-and-IMAP-en/browse_thread/thread/8be2c0b2bf383c15/7c57310cd5b11fc9?pli=1
[Update on 2016-06-30: The above link will not necessarily work, demonstrating why link-only answers are frowned upon so...]
The messages are made available in batches. After retrieving a batch, re-connect to get the next batch. Repeat as required.

in AUTH, instead of using:
USER foo#gmail.com
use:
USER recent:foo#gmail.com

instead of using pop3 u can use imap ptotocol to retrive all mails from GMAIL inbox.

Related

Email quota restricted to 50 emails for app script [google-apps-script]

I have contacted Google Support and they have directed me here
I'm using a Mail Merge AppScript which can be found here
Code can be found here
It says that it complies with Google's daily quotas for sending mail but I'm only able to send 50 emails per 24-hours with a G Suite Basic account which has a listed quota of 1,500 recipients per day (however the Google support colleagues said it's 2,000).
I am sending to individual people and Bcc'ing a different email to each of them (the Bcc email is the same email for each unique recipient), which, I believe only counts towards 1 of my daily allowance as the quota is for unique email recipients, right?
Anyway, I send using the mail merge script and it works for 50 people and then says the limit has been reached yet I'm able to send regular, manual emails from mail.google.com which suggests the limit for my entire G Suite Basic account has not been reached but instead is something on the side of the app code?
Google Support linked me here and said that my quota for scrips could be increased by asking... It seemed a bit weird to me but I'm going along with what I've been told
Thanks for any help or suggestions :-)
Kai

send email from a Microsoft exchange Imap account from MailCore

Ok, so I am building an app that gets and sends emails from your email account, but I have hit a brick wall, the app worst great for POP3 accounts and IMAP accounts, but if are using a exchange IMAP account from a Microsoft Exchange server then it will let you log in and grab the unread emails, but not send anything, this is what i use to send an email
[CTSMTPConnection sendMessage:outMessage server:[dictData valueForKey:#"SMTPServerName"] username:[dictData valueForKey:#"userEmailAddress"] password:[dictData valueForKey:#"password"] port:[[dictData objectForKey:#"SMTPPort"]intValue] useTLS:NO useAuth:YES];
And yes obviously the "username" is not always the email address. I have tried all different types of combinations of setting for the "useTLS" and "useAuth" part (YES/NO, NO/YES, YES/YES, NO/NO). I keep getting an error message back from mailcore saying the "username or password is invalid." --- this only happens when i try sending an email from that account
It is better (and more stable) to use separate SMTP class based on NSSockets
which does the same work as MailCore SMTP client.
NSSocket-based class will be more readable in locking for server connection errors.
We use MailCore only as IMAP part in our mail project.

How do I get E-mail folders from a Gmail.com POP server using VB.net

I have managed to:
Connect to Gmail.com POP server (pop.gmail.com) Port 995 using Socket methods (TcpClient) and POP3 Commands (USER, PASS, STAT)
Get successful response from Gmail.com POP server using POP3 (STAT) command to my VB.net application (+OK)
Retrieve E-mails list from my Gmail.com account
Read those E-mails in plain Text format using a Textbox control.
The problem is that i get all the E-mails from the whole account, means :
If the inbox folder has (90) E-mails, sent folder has (10) E-mails and trash folder has (10) E-mails, then i get (100) E-mails in my application and they are not categorized, means you can not tell which one of them from inbox and which one is from trash.
So, my question is:
Is there a way to retrieve these Folders separately in my VB.net application ?
No, at least not with POP3.
The POP3 protocoll does not offer things like folders. You should probably use the IMAP protocoll, then.

How to retrieve only new emails using POP3 protocol

I am using POP3 protocol to retrieve my emails in my .NET application. I need to read just new emails only but found in many blogs that it is not possible to retrieve just "unseen" or "new" mails using POP3. Is that true? If so, could you please help me understand how Outlook Express manages to get new mails using POP3?
Is there any way that I can flag the seen mails in the email server itself? Or please help me find out a way to retrieve new mails using POP3 protocol.
You have to store the UIDL of each email in a local database. When you want to check for new mail, you retrieve the UIDLs on the server and see if you have if already in your local database; if not, it's a new mail.
Outlook uses the same strategy, BTW (see this KB article).
As long as your mailbox doesn't keep a copy of the emails on the server then you are fine and don't have to code for this.
Normally when an email client access the emails from a POP3 box they are downloaded and removed from the server.
Exchange is a different thing entirely.
Cheers

When the mail is fetch using POP3, the mail count shown is different than what is shown by the browser

I have been assigned to make a mail client which access the mail from POP3 of Yahoo server. By spending some days, I have successfully made the mail client. My application is correctly fetching the mails from POP3 server and it is sending the mail to the SMTP server.
The problem is; the application can only fetch the mails which are having the recieved date within 60 ~ 70 days (I am not sure about the day count).
When I checked the account in the browser, I can see all the mails, but when I fetched the mail from my mail client it is only retrieving the mails which were received within 60 ~70 days of period.
Also, When I used OpenSSL to check the mails, the mail count shown by using openSSL client is same as what of my application is fetching.
I wanted to know whether it is a behavior of Yahoo!Pop3 or it is same in case of all other mail service providers. It would be a great help if someone can provide me the URL reference which shows that one can not retrieve the mail from POP3 when the received date of mail is before 60 ~ 90 days (or whatever limit it is).
I am not sure Yahoo! POP3 servers support it, but you might try to check the EXPIRE capability. It tells you for how long the POP3 server will keep the emails.
No-where is it specified for how long a general POP3 server will keep messages. Gmail by default deletes them from all future POP3 session when a mail has been fetched - but the mail is still available using a browser session. Another server I am using never deletes the messages (and are available for infinite days).