[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TidTelnet to send SMTP Emails...freezing

Posted on 2007-10-19
9
Medium Priority
?
1,364 Views
Last Modified: 2013-11-23
Dear Experts,

We have a huge list of email adresses of our customers and we need to find out which email adresses are still valid and which are not before sending out informations.

to do this, the idea is to connect to the SMTP server, pass the RCPT TO command and depending on the answer of the server we will then know if the email is valid or not.

The problemi i have, using the Telnet Indy component, is that many times it freezes or it gets a message "gracefully disconnected" . I've put an AntiFreeze component but it doesn't help.

I'm not sure i'm using the correct way to read the result of the connection, or i should use some kind of event handler before trying to read the answer of the server...could you help?

the code i'm testing is the following (replaced original values with 'bogus')

 telnet.Host := 'mailhost.domain.com';
 Adomain := 'user@domain.com';
 telnet.Port := 25;
 telnet.ConnectTimeout := 2000;
 telnet.ReadTimeout := 2000;

 try
       telnet.Connect;
       telnet.SendCmd('ehlo bogus.net');
       telnet.SendCmd('mail from: <mailings@bogus.net>');
       telnet.SendCmd('rcpt to: <' + Adomain + '>');
       telnet.SendCmd('quit');
       memo1.Lines.Add(IntToStr(telnet.LastCmdResult.NumericCode));
       memo1.Lines.Add(telnet.LastCmdResult.Text.CommaText);
          if (telnet.LastCmdResult.NumericCode = 250) then
             begin
              label3.Caption := 'Email is valid';
             end;
          if (telnet.LastCmdResult.NumericCode = 550) then
             begin
              label3.Caption := 'Email is NOT valid';
             end;
          if (telnet.LastCmdResult.NumericCode <> 250) and
             (telnet.LastCmdResult.NumericCode <> 550) then
             begin
               label3.Caption := 'Error code: ' + IntToStr(telnet.LastCmdResult.NumericCode);
             end;
       telnet.Disconnect(False);

 except
  on E : Exception do
    Begin
     memo1.Lines.Add(E.ClassName + ' : ' + E.Message);
         label3.Caption := 'Error code: ' + E.Message;
     telnet.Disconnect(True);
    end;
 end;
0
Comment
Question by:dcrudo
  • 4
  • 3
8 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 20107592
at what place in your code do you get this exception or the freeze?
0
 
LVL 1

Author Comment

by:dcrudo
ID: 20108665
IT freezes not always at the same point...but ususalyl executing a command like:

telnet.SendCmd('ehlo bogus.net');

it looks like is waiting for an answer...or it get stuck...
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 20108674
are you always using the same SMTP server?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:dcrudo
ID: 20108749
Hi,

no...the smtp changes as i do a DNS lookup first... but i found this information that maybe has some hints...

http://groups.google.com/group/borland.public.delphi.internet.winsock/msg/96b09becc1840219

but it freezes stil...
(using the TidTCPClient)
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 20109238
freezes could simply mean the smtp server is down or very busy...
0
 
LVL 1

Author Comment

by:dcrudo
ID: 20109443
...if i query the same server manually...it works fine... i think there is something wrong with the use of the components...maybe there is away to wait for an answer... and even the timeout doesn't work...when this happen...even i set the timeout to 2000ms...it stays frozen...
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 2000 total points
ID: 20109518
but you're querying quite fast, maybe the smtp server can't handle that, or there might even be a mechanism which prevents you from connecting too many times per minute/hour.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21216677
Forced accept.

Computer101
EE Admin
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month20 days, 7 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question