Solved

Help using Sockets

Posted on 1998-09-11
2
556 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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