Is there a hard limit for SMTPSecureSocket queue size?

I’m using SMTPSecureSocket to send about 100 club members a personalised news update. Current strategy to iterate through the members database, fetch Member Name, and Member Email Address. Then build the message body and add the individual email message with SMTPSecureSocket.Messages.Append

Once all member’s messages have been appended to the queue, I fire it off with the .SendMail method.
.
It all works fine - until… (have been using this code successfully for over 2 years).

I recently decided to attach a small pdf form to each email. Only about 100kb

The .SendMail command gets issued, but the socket appears to hang. Polling the socket for LastErrorCode, or trapping any of the error events produces nothing. ie no error appears to be triggered. But no mail gets sent at all, and the socket just sits there doing nothing.

Have I hit a memory limit or something?

I could use alternative strategy, and append only 1 message per queue, then Send it, then place another message in the queue, and Send it. Is that best practice?
Any thoughts? Ta lots!

Best practice is to place the PDF on a web server and provide a link to it in the email.

You might try calling the Poll method of the socket once in a while to push it along. Put it in a timer and call it once per second or so while the mail is going out.

Thanks David - you are dead right. Doh! Why didn’t I think of that!!

Greg,
Yes, I already have a 1 second timer which calls the Poll method of the socket, but I still do not see any error events firing. Brings me to another question… the Language Ref documentation for SMTPSecureSocket.Poll() is very sparse, and I do not fully understand what it does, or how to use it to interrogate the status of the socket.

What I currently do, is code the socket’s event handlers (Error, MessageSent, ServerError, etc) to set flags in various webpage.properties. I then have the timer action event inspect those flags after calling the socket’s poll method. Is that a valid strategy??

I’d expect that to work fine. That said, does this behavior occur on your desktop when doing a debug run? If so, put a breakpoint on the first line of each event and inspect the SMTPSecureSocket object to see if any errors have occurred.

As far as a hard limit, have you considered that the limit might be on your email provider’s outgoing server? They may not allow you to send 10MB of emails in one batch (100K * 100 emails).

Thanks Greg,

That’s a good point.

Also, while testing my code, I commented out the Socket.SendMail line of my code, so that I could run tests to inspect the recipents array, etc without actually sending any mails - and to my great surprise, mail still gets sent!! How come?? Does polling the socket trigger a send??

It shouldn’t.

Well there’s a strange one! I have searched the whole code, and can confirm there is no instance of “mySMTP.SendMail” anywhere in the entire app - but mails still get sent!!

Trust me to find that one! LOL

Anyway, it’s not a serious issue, now I know about it…

Try searching for just SendMail. It could just as easily be me.sendmail, self.sendmail, etc…

Greg,
Yes I have (see screenshot) - and I can confirm that both debug mode on Windows, and cgi app on Apache will send emails after all references to SendMail have been commented out. Compiled under 2014r3.1 and 2015r2.2 = identical behaviour.