Solved

Help using Sockets

Posted on 1998-09-11
2
553 Views
Last Modified: 2010-05-18
I am trying to make a program for the ISP I work for that connects to the SMTP Server and verifies that a particular account exists using the 'VRFY mailbox' command.
I have practically no resources on Delphi, so I am mostly learning by trial and error and the HELP file included (no examples).

Here's what I have so far:
    UserAddr := User + '@myispdomain.net';
    SMTPComm := 'VRFY ' + UserAddr + Chr( 13 ) + Chr( 10 );
    WITH ClientSocket1 DO BEGIN
             Host := 'smtp.myispdomain.net';
      Port := 25;
      Open;
    END;

    Incoming := ClientSocket1.Socket.ReceiveText;
    WITH ClientSocket1 DO BEGIN
         Incoming := Copy( Incoming, 1, 3 );
           Val( Incoming, ErrCode, Code );
         IF ErrCode = 220 THEN BEGIN
            Socket.SendText( SMTPComm );
            Incoming := Socket.ReceiveText;
          Incoming := Copy( Incoming, 1, 3 );
              Val( Incoming, ErrCode, Code );
         END {IF};
         Close {Socket};
     END {WITH};

The Main problem I am having is that if I "trace" the program while debuggin, it works GREAT! but when I run the program through, it does NOT wait for a reply from the Server after connecting or sending the VRFY command, even when i created the socket with a ClientType := ctBlocking.

How can I make it WAIT for an event before continuing with the program?
Can anyone give me an example of Socket code of this nature with a basic event/error trap?


0
Comment
Question by:DropZone
2 Comments
 
LVL 18

Author Comment

by:DropZone
ID: 1339427
NOTE: I am trying NOT to use the SMTP ActiveX component included in Delphi3 because I want to compile the program into a single EXE file for simplicity.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1339428
Hi DropZone,

Only one place when you need to work with TSocket, TSmtp, etc...

Go to freeware components of

http://www.rtfm.be/fpiette/indexuk.htm

Send him just a postcard and add yourself to the free (great by the way!) Help mailing list!

Look at his demo-examples too! Everything WITH SOURCES

Regards, Zif.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now