Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

October 27, 2005

SMTPQ Discussion

Question:

If I want to send emails to 1000 people, is the code below enough?


// This sample code happens to be Delphi using Turkish characters…

ChilkatMailMan21.UnlockComponent(’Anything for 30-day trial’);
ChilkatMailMan21.SmtpHost:=’something’;

For x:=1 to people do
begin

email := ChilkatMailMan21.NewEmail();
email.charset := ‘windows-1254′;
email.Subject := ‘ığüşiöçIĞÜŞİÖÇ’;
email.From := ‘***’;
email.AddTo('’,peopleemail[x]);

email.SetHtmlBody(memo1.Text);

ok := ChilkatMailMan21.SendEmail(email);
if (ok = 0) then
ChilkatMailMan21.SaveLastError(’errorLog.xml’);

end;

Answer:

This will certainly work, but it sends a single email at a time synchronously. The Chilkat SMTPQ service can be used to increase efficiency and reliability.

The only change in your program would be to call SendQ instead of SendEmail. The SendQ method deposits the email in a queue directory where the SMTPQ background service detects the new email and sends it. There is a lengthy re-try process that SMTPQ will attempt under certain failure conditions — for example, if the network is temporarily disconnected. Also, if the computer is shutdown during the sending process, the SMTPQ will pick up where it left off and continue re-sending when the computer reboots.

The Chilkat SMTPQ is also multi-threaded, and you can configure how many threads you wish to run. However, too many threads using a single SMTP server is bad because most SMTP servers have a limit on how many simultaneous connections are accepted from a single IP address.

An interesting way to use SMTPQ is to create an SMTP farm, so to speak. For example, if you have 5 SMTP servers, your application can cycle through the SMTP servers as it sends each email. For example:


ChilkatMailMan21.UnlockComponent(’Anything for 30-day trial’);

smtpIdx := 0;
For x:=1 to people do
begin

email := ChilkatMailMan21.NewEmail();
email.charset := ‘windows-1254′;
email.Subject := ‘ığüşiöçIĞÜŞİÖÇ’;
email.From := ‘***’;
email.AddTo('’,peopleemail[x]);

email.SetHtmlBody(memo1.Text);

ChilkatMailMan21.SmtpHost:=smtpServer[smtpIdx];
smtpIdx++;
if (smtpIdx > 4) smtpIdx := 0;

ok := ChilkatMailMan21.SendQ(email);
if (ok = 0) then
ChilkatMailMan21.SaveLastError(’errorLog.xml’);

end;

This is interesting because each thread within SMTPQ would likely be communicating with separate SMTP servers, greatly increasing the throughput of the system.


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.