[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Help using Sockets

Posted on 1998-09-11
2
Medium Priority
?
563 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 300 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 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