-
Dec 1st, 2022, 09:00 AM
#1
Thread Starter
New Member
SMTP email generates error on 11th email send
Hope to resolve this issue soon.
I have a vb.net console application that was in production for a client sending out reminder emails to clients every morning. It would read who to send to from a database, go through a loop and send to each. Depending on the day, it would send between 10-35 emails. Over the last month when it gets to the 11th email it would throw an error - "The transport error code was 0x80040217. The server response was not available"
From this application I reduced it down to eliminating the database, and simply put in a for loop for 15 iterations, sending a test email to myself, for testing purposes. In the loop it sends the exact same email (nothing changes). I get the same result - sends 10 and fails at the 11th attempt.
I am using no-ip.com's Alternate-port SMTP product with a daily email limit of 2000 emails. I am nowhere near the limit.
In the vb code, I'm using CDO to setup and send the emails, which is working for 10 as mentioned above.
I currently have a support ticket open with no-ip.com and moving slowly through their trouble-shooting and have the feeling that they are going to say they see 10 emails come through an no errors (could be wrong, but we'll see).
I was thinking maybe my isp is putting a limit on the calls to no-ip.com... not sure, so I took the application and moved it to a dedicated server I have at Tier.net, ran it there and got the same result (sends 10 emails then error on the 11th).
What do you guys think, No-ip.com, ISP or something else?
Is there a way to pull more information on where the error is coming from?
Thanks for any advise.
Dan
-
Dec 1st, 2022, 09:09 AM
#2
Re: SMTP email generates error on 11th email send
Almost certainly a "send rate" limit being reached somewhere along the line. Have you tried adding some sort of delay in your code, which would make it pause for 5 or 10 seconds after each email is sent? If the amount of email being sent per day is the amount you say it is, then that sort of delay between emails should be of no concern, and will likely resolve the issue.
-
Dec 1st, 2022, 09:12 AM
#3
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Yes, I tried a 2, 5, 10 second delay and did not make a difference.
I'll try a 15 and 20 to see if they get through.
-
Dec 1st, 2022, 09:31 AM
#4
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
15, 20 did not work. I tried it at 32 seconds and it did work. Was able to send all 15 emails.
So where do you think this limit is coming from, the isp?
-
Dec 1st, 2022, 09:38 AM
#5
Re: SMTP email generates error on 11th email send
As described, it is almost certainly the SMTP server enforcing some limitation.
-
Dec 1st, 2022, 09:57 AM
#6
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
OK, thanks. I'll follow through with the ticket I have open with them today.
-
Dec 1st, 2022, 11:21 AM
#7
Re: SMTP email generates error on 11th email send
One additional possibility is that this SMTP server product you are using may be doing some sort of spam checking on all email sent through it and imposing stringent sending restrictions based on x number of "potential spam" emails sent in y amount of time.
If the emails you are sending out could be triggering a "potential spam" alarm, were I in your shoes, I would create a new project that attempts to send extremely innocent looking emails, ones that have no hyperlinks, a very short body, and maybe have each email be different in some way. Then, have this program attempt to send 11 or 15 or 20 of these emails and see if the behavior is the same.
If it is again capped at 10, then that would seemingly remove "content" as being a factor, and point to a hard limit of 10 emails in some period of time (based on your testing, it would appear that the limit is 5 minutes).
Good luck.
-
Dec 2nd, 2022, 12:37 PM
#8
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Thanks - yes, that's what I did. I put "Test Email" in the body and "Test" as the subject and got the same limitation at 10.
Still have an open ticket with no-ip and the support group is going to check with their developers to see if there is some sort of timing limit being imposed. He did say that it could be some sort of email client timing problem, but I don't buy that...
-
Dec 2nd, 2022, 02:29 PM
#9
Re: SMTP email generates error on 11th email send
Yeah, when it is completely reproducible at > 10 emails with varying sending delays < 30 seconds, and works with a sending delay at 32 seconds, it is as close to a mathematical certainty that the maximum is 10 emails within 5 minutes somewhere.
Presumably you are able to specify the "From" address as part of this process. If you have your code change "From" for each email it sends, does the limit go away? It is theoretically possible that the limit is 10 emails within 5 minutes from any single email address.
Just an idea. Good luck.
-
Dec 2nd, 2022, 02:57 PM
#10
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
The behavior is the same if i toggle between two different from emails.
Good idea though.
-
Dec 2nd, 2022, 03:26 PM
#11
Re: SMTP email generates error on 11th email send
Can you sent 10 emails with no pause ... then wait 30 seconds, then try to send another 10?
-tg
-
Dec 2nd, 2022, 04:28 PM
#12
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Just gave that a test and same thing - with error on #11.
My guess is that it has to do with # of emails in a total period of time which seems like its a lengthy amount of time (32 seconds between each send).
-
Dec 2nd, 2022, 05:26 PM
#13
Re: SMTP email generates error on 11th email send
Dialing in some precise timing limits could be helpful to the vendor. I still posit that you're dealing with a "10 emails in a rolling 5 minute window" limitation.
I would try two things:
Have your program send 10 emails with no delay between them, then have it wait 290 seconds, and have it try an 11th email. If my theory is correct, it will fail.
Have your program send 10 emails with no delay between them, then have it wait 310 seconds, and have it try an 11th email. If my theory is correct, it will succeed.
I should note, that this assumption of mine is based on my assumption that much earlier in the thread, when you responded to my post about adding delays between each email, that the 32 second delay you mentioned working was between each individual email being sent.
-
Dec 2nd, 2022, 05:29 PM
#14
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Yes, the 32 second delay was between each email.
I'll give your 2 suggestions a try tomorrow and let you know what I get - Thanks!
-
Dec 3rd, 2022, 05:39 AM
#15
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Here are the results of the test:
310 - completed
290 - completed
200 - error after 10
145 - error after 10
Looks like no-ip.com is the culprit. Here was their response late last night:
"After reviewing the logs it appears you're hitting our max concurrent connection limit.
Our max concurrent connection limit is 10 connections.
Once you hit the max we will refuse the request and you will need to close connections before you can try sending again.
Feel free to try sending keeping in mind the above note.
Apologies for the inconvenience or confusion.
If you have any other questions or concerns feel free to reach out."
I'm not sure what they are watching to group the 10 requests together and apply the limit. What I just tested was this:
Limit the loop to 10 emails and 0 delays.
Run the program.
Immediately after completion, run the same program again to completion.
Net result is I was able to send 20 emails in about 17 seconds.
So, the question now is, am I not completely closing the objects or not closing them properly in the loop?
This is what I'm doing at the end of my loop:
objCDOSYSMail = Nothing
objCDOSYSCon = Nothing
-
Dec 3rd, 2022, 09:18 AM
#16
Re: SMTP email generates error on 11th email send
Yeah, at this point you need to post more code. You are probably doing some sort of connection establishing for each email, when it probably only needs to be done once and reused for each email.
-
Dec 4th, 2022, 08:13 AM
#17
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
So I ran a different test using the code below which uses the .Net mail namespace instead of CDO and it had no blocking issues sending 20 emails. I'm going to switch to this. Thanks for the help trouble-shooting!
Imports System.Net.Mail
Module Module1
Sub Main()
Dim Mail As New MailMessage
For i = 1 To 20
Mail.Subject = "test email"
Mail.To.Add("a@a.com")
Mail.From = New MailAddress("b@b.com")
Mail.Body = "This is a test email"
Dim SMTP As New SmtpClient("smtp-client")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("username", "password")
SMTP.Port = "587"
SMTP.Send(Mail)
SMTP = Nothing
Next
End Sub
End Module
-
Dec 4th, 2022, 11:39 AM
#18
Re: SMTP email generates error on 11th email send
hmmm.... what if you move the creation of the Smtpclient to ouside the loop.... create it once, then just re-use it inside the loop.
Code:
Imports System.Net.Mail
Module Module1
Sub Main()
Dim Mail As New MailMessage
Dim SMTP As New SmtpClient("smtp-client")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("username", "password")
SMTP.Port = "587"
For i = 1 To 20
Mail.Subject = "test email"
Mail.To.Add("a@a.com")
Mail.From = New MailAddress("b@b.com")
Mail.Body = "This is a test email"
SMTP.Send(Mail)
Next
SMTP = Nothing
End Sub
End Module
-tg
-
Dec 5th, 2022, 09:38 PM
#19
Re: SMTP email generates error on 11th email send
a client is paying you for this? i know i aint been around for a while but we now helping school kids with silly email spammers?
-
Dec 6th, 2022, 09:25 AM
#20
Thread Starter
New Member
Re: SMTP email generates error on 11th email send
Like I said, this particular code worked fine and did not error after 10 emails. I took your suggestion and applied that to my CDO version and it appears as though that has corrected the problem - Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|