Solved

Help using Sockets

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 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