Sending mails with SMTPSecureSocket leads to timeout

Hello!
I’m a silently reading so far in this great forum having few experiences with Xojo and working with Real Studio 2012 release 2.1.

Now I wrote a small mail app that is sending bulk mails to our user group (around 200 addresses in list). I’m using the SMTPSecureSocket class as adviced.

In the first step I prepare mails using EMailMessage class and using SMTPSecureSocket.Messages.Append method to add them. Then using SMTPSecureSocket.SendMail() to send them.

In the events of SMTPSecureSocket I’m testing for errors (through a timer) and that’s it.

It is working for about 40 mails. Then sending mails stopps. No errors, nothing. It just stops.

I have tried different connection types (SSLv23 and TLSv1), but that did not the trick.

I’m not doing anything unusual in the SMTPSecureSocket events. Besides in MessageSent and ServerError events I’m updating a REALSQLdatabase where I store some information about the mailing sent. Is this disallowed ?

Anyway, on OS X 10.9 Mac mini with OS X 10.9 server it stops after 40 mails. On OS X 10.8.5 and Linux server, it is working. But can exclude server errors, since other mailing apps are working fine of the OS X 10.9 server. I also tried to run my software directly on the OS X 10.9. server to work around network problems. Same result. 40 mails are sent, others not. On the end of this message the SMTP log excerpt from OS X 10.9. server when failing.

I would really appreciate any advice since I’m down currently with my knowledge.

Kind regards,
Thomas.

[14/Oct/2014 22:59:11][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:12][4496519168] {smtps} Command RCPT TO: xxxx@web.de
[14/Oct/2014 22:59:12][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@web.de ok (remote)
[14/Oct/2014 22:59:12][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:12][4496519168] {smtps} 15067 bytes received in command DATA
[14/Oct/2014 22:59:12][4496519168] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:12][4496519168] {smtps} Command MAIL FROM: news@xxx.xxx
[14/Oct/2014 22:59:12][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:12][4496519168] {smtps} Command RCPT TO: xxxx@gmx.de
[14/Oct/2014 22:59:12][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@gmx.de ok (remote)
[14/Oct/2014 22:59:12][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:12][4496519168] {smtps} 15058 bytes received in command DATA
[14/Oct/2014 22:59:12][4496519168] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:12][4496519168] {smtps} Command MAIL FROM: news@xxx.xxx
[14/Oct/2014 22:59:12][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:13][4496519168] {smtps} Command RCPT TO: xxxx@go-dancing.eu
[14/Oct/2014 22:59:13][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@go-dancing.eu ok (remote)
[14/Oct/2014 22:59:13][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:13][4496519168] {smtps} 15088 bytes received in command DATA
[14/Oct/2014 22:59:13][4496519168] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:13][4496519168] {smtps} Command MAIL FROM: news@xxx.xxx
[14/Oct/2014 22:59:13][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:13][4496519168] {smtps} Command RCPT TO: xxxx@aol.com
[14/Oct/2014 22:59:13][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@aol.com ok (remote)
[14/Oct/2014 22:59:13][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:13][4496519168] {smtps} 15070 bytes received in command DATA
[14/Oct/2014 22:59:14][4496519168] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:14][4496519168] {smtps} Command MAIL FROM: news@xxx.xxx
[14/Oct/2014 22:59:14][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:14][4496519168] {smtps} Command RCPT TO: xxxx@gmx.de
[14/Oct/2014 22:59:14][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@gmx.de ok (remote)
[14/Oct/2014 22:59:14][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:14][4496519168] {smtps} 15073 bytes received in command DATA
[14/Oct/2014 22:59:14][4496519168] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:14][4496519168] {smtps} Command MAIL FROM: news@xxx.xxx
[14/Oct/2014 22:59:14][4496519168] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.xxx ok
[14/Oct/2014 22:59:14][4496519168] {smtps} Command RCPT TO: xxxx@web.de
[14/Oct/2014 22:59:14][4496519168] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@web.de ok (remote)
[14/Oct/2014 22:59:15][4496519168] {smtps} Command DATA
[14/Oct/2014 22:59:19][4544593920] {smtps} Command QUIT
[14/Oct/2014 22:59:19][4544593920] {smtps} SMTP server session end
[14/Oct/2014 22:59:19][4544593920] {smtps} Task 11942 handler END
[14/Oct/2014 22:59:22][4555018240] {smtps} Task 11943 handler BEGIN
[14/Oct/2014 22:59:22][4555018240] {smtps} Task 11943 handler starting
[14/Oct/2014 22:59:22][4555018240] {smtps} SMTP server session begin; client connected from 190.210.xxx.5:39876
[14/Oct/2014 22:59:22][4555018240] {smtps} Looking up address 190.210.xxx.5 in DNS blacklist SpamHaus SBL-XBL…
[14/Oct/2014 22:59:22][4555018240] {smtps} Address 5.132.210.190.zen.spamhaus.org not found in DNS blacklist SpamHaus SBL-XBL
[14/Oct/2014 22:59:22][4555018240] {smtps} Looking up address 190.210.xxx.5 in DNS blacklist NiX Spam…
[14/Oct/2014 22:59:22][4555018240] {smtps} Address 5.132.210.190.ix.dnsbl.manitu.net found in DNS blacklist NiX Spam (127.0.0.2)
[14/Oct/2014 22:59:22][4555018240] {smtps} Delaying SMTP greeting to 190.210.xxx.5:39876 for 15 seconds
[14/Oct/2014 22:59:38][4555018240] {smtps} Sent SMTP greeting to 190.210.xxx.5:39876
[14/Oct/2014 22:59:38][4555018240] {smtps} Command EHLO xxx.com
[14/Oct/2014 22:59:38][4555018240] {smtps} Sent reply to EHLO: 250 mail.xxx.xxx …
[14/Oct/2014 22:59:38][4555018240] {smtps} Command MAIL FROM:xxxx@xxxx.COM SIZE=2952
[14/Oct/2014 22:59:38][4555018240] {smtps} Sent reply to MAIL: 250 2.1.0 Sender xxx@xxx.COM ok
[14/Oct/2014 22:59:38][4555018240] {smtps} Command RCPT TO:kontakt@xxx.xxx ORCPT=rfc822;kontakt@xxx.xxx
[14/Oct/2014 22:59:38][4555018240] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient kontakt@xxx.xxx ok (alias)
[14/Oct/2014 22:59:38][4555018240] {smtps} Command DATA
[14/Oct/2014 22:59:38][4555018240] {smtps} 2951 bytes received in command DATA
[14/Oct/2014 22:59:38][4555018240] {smtps} Message accepted for delivery
[14/Oct/2014 22:59:38][4555018240] {smtps} Command QUIT
[14/Oct/2014 22:59:38][4555018240] {smtps} SMTP server session end
[14/Oct/2014 22:59:38][4555018240] {smtps} Task 11943 handler END
[14/Oct/2014 23:01:15][4496519168] {smtps} Command DATA failed: Connection closed by remote host 127.0.0.1 prematurely.
[14/Oct/2014 23:01:15][4496519168] {smtps} SMTP server session end
[14/Oct/2014 23:01:15][4496519168] {smtps} Task 191 handler END
[14/Oct/2014 23:07:38][4544593920] {smtps} Task 11944 handler BEGIN
[14/Oct/2014 23:07:38][4544593920] {smtps} Task 11944 handler starting
[14/Oct/2014 23:07:38][4544593920] {smtps} SMTP server session begin; client connected from 218.64.xxx.79:20678

Your error log shows that your IP address is getting trapped by the SPAM filters on some of the receiving servers. That isn’t a problem with your app, it’s a problem with you or your ISP.

Thank you Carl for your reply.

I was concerned about the line

[14/Oct/2014 23:01:15][4496519168] {smtps} Command DATA failed: Connection closed by remote host 127.0.0.1 prematurely.

In my mind it indicated that the software, which ran directly on the OS X Server, closed the connection for whatever reason.

I made another test; unfortunately it seems to be a problem with the SMTPSecureSocket class. Here is the output after sending 62 messages:

[17/Oct/2014 14:58:31][4542459904] {smtps} Command RCPT TO: xxxx@web.de
[17/Oct/2014 14:58:31][4542459904] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@web.de ok (remote)
[17/Oct/2014 14:58:31][4542459904] {smtps} Command DATA
[17/Oct/2014 14:58:31][4542459904] {smtps} 15088 bytes received in command DATA
[17/Oct/2014 14:58:31][4542459904] {smtps} Message accepted for delivery
[17/Oct/2014 14:58:31][4542459904] {smtps} Command MAIL FROM: news@xxx.tld
[17/Oct/2014 14:58:31][4542459904] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.tld ok
[17/Oct/2014 14:58:31][4542459904] {smtps} Command RCPT TO: xxxx@arcor.de
[17/Oct/2014 14:58:31][4542459904] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@arcor.de ok (remote)
[17/Oct/2014 14:58:31][4542459904] {smtps} Command DATA
[17/Oct/2014 14:58:31][4542459904] {smtps} 15073 bytes received in command DATA
[17/Oct/2014 14:58:31][4542459904] {smtps} Message accepted for delivery
[17/Oct/2014 14:58:31][4542459904] {smtps} Command MAIL FROM: news@xxx.tld
[17/Oct/2014 14:58:31][4542459904] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.tld ok
[17/Oct/2014 14:58:31][4542459904] {smtps} Command RCPT TO: xxxx@googlemail.com
[17/Oct/2014 14:58:31][4542459904] {smtps} Sent reply to RCPT: 250 2.1.5 Recipient xxxx@googlemail.com ok (remote)
[17/Oct/2014 14:58:32][4542459904] {smtps} Command DATA
[17/Oct/2014 14:58:32][4542459904] {smtps} 15109 bytes received in command DATA
[17/Oct/2014 14:58:32][4542459904] {smtps} Message accepted for delivery
[17/Oct/2014 14:58:32][4542459904] {smtps} Command MAIL FROM: news@xxx.tld
[17/Oct/2014 14:58:32][4542459904] {smtps} Sent reply to MAIL: 250 2.1.0 Sender news@xxx.tld ok

now the command RCPT TO: should be next one, but instead of it comes:

[17/Oct/2014 14:58:48][4570943488] {smtps} Command QUIT

Why is the command QUIT being sent although there are still mails in the queue ?

You could try to use MBS CURL Plugin instead. There we can have much more control about details.

It’s possible that your SMTP socket property is going out of scope. Make sure it is defined outside of the method you are using to send with and that it exists long enough to send all of the messages.