Archived Forum Post

Index of archived forum posts

Question:

421 4.7.0 Error: too many connections

May 26 '16 at 09:33

Hi Team,

   We are using the chilkat component to send the mail to the users. when we send the bulk mails(looping

through), most of them receiving and some users not are receiving the emails which we sent and got the below error. This issue happening intermittently.Please help me to resolve this issue ASAP. Urgent issue.

Chilkat Version : ChilkatDotNet2_x64 - 8.1.2.0

Error:

ChilkatLog: SendEmail: DllDate: Mar 5 2007 SMTP_Connect: Connecting to SMTP server smtp1.xx.com:25 smtp_host: smtp1.xx.com smtp_port: 25 smtp_user: NULL trying_auth_method: NONE 421 4.7.0 Error: too many connections InitialResponse: 421 4.7.0 Error: too many connections Failed to get initial SMTP response.. The SMTP server may be denying access for this domain. Failed to connect to SMTP server.

Code sample:

        Chilkat.MailMan mailman = new Chilkat.MailMan();

        mailman.UnlockComponent("XXXXXX");
        mailman.SmtpHost = "smtp1.xx.com";
        mailman.SmtpPort = 25;

        Chilkat.Email email = new Chilkat.Email();
        email.Subject = "Test Email";
        email.Body = "This is the test email. please ignore.";
        email.AddTo("deepu", "deeparaj.j@gmail.com");

        bool success = mailman.SendEmail(email);

Thanks, Deeparaj


Accepted Answer

You can increase the connections on the email server, both unix and windows have configurations for this.

or when you get the error, set up a loop, sleep for some time, and try again.


Answer

I think the creation of the Mailman instance should not be inside the loop. Every Mailman will cause a new connection to the SMTP server. I guess it should be something like this:

Chilkat.MailMan mailman = new Chilkat.MailMan();
mailman.UnlockComponent("XXXXXX");
mailman.SmtpHost = "smtp1.xx.com";
mailman.SmtpPort = 25;

For.... Chilkat.Email email = new Chilkat.Email(); email.Subject = "Test Email"; email.Body = "This is the test email. please ignore."; email.AddTo("deepu", "deeparaj.j@gmail.com"); bool success = mailman.SendEmail(email); End For;