Solved

Help using Sockets

Posted on 1998-09-11
2
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 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