Is there any limits on how many concurrent clients you can connect to one mail account?
I have an app that opens a new ImapClient on each request. The ImapClient will open INBOX and FolderA, and move a mail by UID from one to another. The multiple clients will never access the same mail concurrent, but probably move multiple mails in same account concurrent.
Errors seems to occur once I hit about 5+ clients simultanious, using Exchange, and response with a lot of different errors as:
"The IMAP server replied to the 'COPY' command with a 'NO' response."
"The IMAP server replied to the 'EXPUNGE' command with a 'NO' response."
When I'm moving mails I do following sequence:
Using a new ImapClient
Connect and auth the client
GetFolderAsync of INBOX and FolderA, then wait for the response
Open the INBOX with OpenSync() with ReadWrite, and wait for the task.
Fetch INBOX with FetchAsync(), looping through the result to find the wanted UID based on MessageID
Calling MoveToAsync() moving the mail based on uid to the FolderA, and waiting
FolderA.SetFlagAsync() with new UID, and flagging the mail with SEEN
Waiting on 6. & 7.
INBOX.SetFlagAsync() with the previous UID, and flagging the mail with DELETED, wait for the operation
Closing IMAP folders using INBOX.CloseAsync and FolderA.CloseAsync
There is no standard that defines the maximum number of clients an IMAP server will allow. I've read that Thunderbird uses a max of 5 concurrent connections (which probably suggests they found that worked well for most IMAP servers in the wild), so that might explain what you are seeing.
Related
I want to send above 500 to 2500 mails at a time using SMTP currently it is working for me but it is taking too much for all mails have to delivered so please suggest me the best method to send bulk mails with very less possible time, I used the below code.
string readMail = null;
System.Net.Mail.SmtpClient smtpClient = null;
smtpClient = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtpClient.UseDefaultCredentials = false;
smtpClient.Host = "smtp.gmail.com";
smtpClient.Port = 587;
smtpClient.Credentials = new NetworkCredential("myemail#example.net", "password");
smtpClient.EnableSsl = true;
smtpClient.SendCompleted += new SendCompletedEventHandler(cleint_Responce);
object userState = m;
try
{
smtpClient.SendAsync(m,userState);
}
Gmail isn’t designed for sending bulk email. If you are planning to send an email message to a large group of friends using Gmail, do read the following rules to avoid temporary lockdown of your Gmail:
Rule 1: You can send emails to a maximum of 500 recipients per day through the Gmail website. Try exceeding the limit and your Gmail account may get temporarily disabled with the error – “Gmail Lockdown in Section 4.”
It is important to note that this limit is around recipients and not messages. Thus you can send 10 emails to 50 people each or 1 email can be addressed to a maximum of 500 people.
Rule 2: If you access Gmail via POP or IMAP clients, like Microsoft Outlook or Apple Mail, you can send an email message to a maximum of 100 people at a time. If you exceed the limit, your account may be disabled for a day with the error – “550 5.4.5 Daily sending quota exceeded.”
Rule 3: Always double check email addresses of recipients before hitting the Send button in Gmail. That’s because your account may get disabled if the email message contains a large number of non-existent or broken addresses (<25 ?) that bounce back on failed delivery.
Rule 4: You can associate multiple email addresses with your Gmail account and send emails on behalf of any other address. However, when sending mail from a different address, the original account’s message limits are applied.
Rule 5: If you are sending emails through Google Script, like in the case of Gmail Mail Merge, the daily sending limit is 100 recipients per day for free Gmail accounts. You can use the MailApp.GetRemainingDailyQuota method to know your existing quota else the script will throw an exception saying – “Service invoked too many times.”
If you wish to send more email messages through Google Scripts, you’ll have to upgrade to Google Apps. Even then, your sending limits will be only be increased after a few billing cycles or if you have opted for 5 or more users.
There are some paid service will help you better on this like Sendblaster
I have an application which uses SmtpClient to send an email. I am trying to send an email to multiple recipients. I have two recipients in my to list e.g "aman#gmail.com,abc#xyz.com". and I am trying to send the email to this list but my application is throwing the exception as below:
Client does not have permission to submit mail to this server. The server response was: 4.7.1 (abc#xyz.com): Relay access denied.
because of this aman#gmail.com is also not able to receive the email.
I need to implement the functionality that even there is an invalid address like abc#xyz.com in the ToList, an email should be sent successfully to aman#gmail.com.
Can anybody please help me in this?
Does this error message come from your own email server, or from that of xyz.com? I'm guessing it's your own server, and that you either need to aunthenticate before sending, or use your own email address for sending (but the latter is kind of a long shot -- "we do not relay" means a server which is neither the sender's or the recipient's refuses to act as a middleman). It is also possible that the mail exchanger for xyz.com is misconfigured (either the MX record in DNS points to the wrong server, or the admin failed to configure it to accept this responsibility - technically basically the same thing) or that your client somehow ends up connecting to the wrong place.
(Not a proper answer but this got too long to fit in a comment.)
I was advised to use OpenPop lib to fetch my mail from hotmail. But I could'nt find any better way to check for new mail except disconnecting and reconnecting again. And there, I found a problem, Hotmail doesn't allow more than 1 pop3 login each 15 minutes. I want to know if it's possible to get the new mail without disconnecting and reconnecting to their pop3 server. Here is my code:
Timer checker = new Timer();
checker.Interval = 1000;
checker.Tick += new EventHandler(delegate
{
Pop3Client client = new Pop3Client();
client.Connect("pop3.live.com", 995, true);
client.Authenticate("my.Email#hotmail.com", "myPassword");
label1.Text = client.GetMessageCount().ToString();
client.Disconnect();
});
checker.Start();
I do not think that servers are allowed to show new mails to you during a POP3 session. I base this upon that it can certainly not delete emails as it would destroy the message numbers.
What would for example happen if the server says you have 100 messages, and when you fetch the message with number 55, it is actually not there since it was deleted in the meantime. I think the same applies to adding new emails during the session. Also, only one client can be logged into a POP3 account at a time, since the account will then be in a locked state. In that locked state, I do not think servers are allowed to change anything during the session.
I do not recall any methods in the POP3 specification which allows you to ask the server if new messages have been delivered.
If Hotmail does indeed only allow one POP3 login per 15 minutes, then I think you are left with just that. I do not know if there are other protocols which could be used here. IMAP is not supported, so that is not an option.
This is not the answer you want - but it is what I can give you.
Doesn't hotmail use DeltaSync also, for the SOAP API ?
You can use oSpy to see what gets sent and received over SSL, and replicate that functionality.
I Am writing Pop3 client for gmail. The problem is that when the email is downloaded then it deletes from pop3 server. I have tried sending RSET command to server but it dose not work.
Do i have to send RSET just before disconnecting or after downloading each mail?
It should only delete the messages if you send/use the DELE command. Since you're writing it yourself.. simply do not use the DELE command: http://www.faqs.org/rfcs/rfc1939.html
The RSET command should also work, too, see from the RFC linked:
RSET
Arguments: none
Restrictions:
may only be given in the TRANSACTION state
Discussion:
If any messages have been marked as deleted by the POP3
server, they are unmarked. The POP3 server then replies
with a positive response.
Possible Responses:
+OK
Examples:
C: RSET
S: +OK maildrop has 2 messages (320 octets)
Gmail's POP3 configuration maybe sometimes confusing.
In the Gmail's web interface in "Settings" on "Forwarding and POP/IMAP" tab you can find a drop down list called "When messages are accessed with POP".
Here's the value list and the Gmail's behavior:
a.
"delete Gmail's copy":
Message is deleted by issuing RETR command.
b.
"keep Gmail's copy in the Inbox":
Message stays in the Inbox,
Web interface says it's unread, however message is not received
for the second time using POP3 client.
c.
"archive Gmail's copy":
Message is deleted by issuing RETR command, however it is
possible to find it using web interface.
Gmail simply ignores DELE command, and does not follow POP3 standard.
Google doesn't handle POP3 in a conventional sense. Once you have downloaded a mail then it is flagged as downloaded and POP3 will act like it has been deleted. But in reality they keep a copy of the mail on the server.
It has been some time, but working on a similar problem, i found out that the TOP command does not mark the message as read within GMail POP3 server.
So, if you do not read the message entirely, you can surely read it back later.
Hope it helps.
Because Gmail POP3 server doesn't work like normal POP3 server, it hides old emails automatically even the email was not deleted by POP3 DELE command.
If you want to read all emails from Gmail mailbox, you can try to implement or find a IMAP4 client. I can use IMAP4 to read all emails in Gmail mailbox.
I was wondering if anyone could help me out (not with code, although that would be appreciated), with the logic behind checking and retrieving messages from a POP3 mail server.
I.e.
Establish connection
Validate credentials
Enumerate message list
Check each message to see if it's "new"
Download "new" message(s).
Would this be the correct way about doing this?
Thank you
The best way of looking at something like this is to have a look what something else does. Run Wireshark or some other packet capture software, and use an e-mail client to check. Anyway, the basics of a POP3 session are as follows:
USER username
PASS password
LIST <-- Shows the size of each waiting message
UIDL <-- Shows a unique ID for each waiting message
RETR 1 <-- Retrieves message with index 1
DELE 1 <-- Deletes the message you just retrieved
QUIT
The first char of all of the responses except RETR will be a + (success) or a - (failure).
If you are deleting messages off the server after retrieving them, you don't need to bother with UIDL. If you are leaving them, you can use UIDL to get a unique ID for each message which you store locally to show you have retrieved that message before.
For more details, see the RFC. Wikipedia also lists a more in depth example, showing the server response.
These should be useful:
POP3 Email Client (.NET 2.0)
POP3 Client as a C# Class
Retrieve Mail From a POP3 Server Using C#
POP3 Sequence Diagram
POP3 Reference