Disconnect after sending SMTP-Mail

If I use the Fastnet Component TNMSMTP to send an e-mail, I've to connect to a mail-server. If I don't have direct access to the internet, my computer automatically connects to it via RAS-Network. After sending and disconnecting from the mail-server the connection to the internet stays remaining. What can I do to disconnect this RAS-connection in D5?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

add ras to the uses section (if you dont have ras.pas header file i can send you one or can get one from any of the delphi component sites(dsp ,torrys etc)..

  RasConn  : TRasConn;
  bsize    : DWORD;
  Count    :  DWORD;

  RasConn.dwSize := SizeOf(TRasConn);
  bsize := SizeOf(RASConn);
  if RASEnumConnections(@RASConn, bsize, Count) = 0 then
     if Count > 0 then RASHangUp(RASConn.hRasConn);

Regards Barry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bussoftwareAuthor Commented:
I would appriciate, if you could send me this component to Olaf.Fries@bussoftware.ch. Thanks a lot.
bussoftwareAuthor Commented:
If I use ras.pas in an own dll on WinNT 4.0, where RAS isn't installed (the rasapi32.dll is missing), I get an error. Is it possible to compile the dll in a way that the rasapi32.dll needn't be in the system folder?
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

bussoftwareAuthor Commented:
Another comment: Your source is right if there is only one RAS connection. Under WinNT you may have more than one, so you have to resize the record.
for this approach at hanging up the connections rasapi32.dll needs to be either on the windows search path (usually windows system)or in your programs directory else it will error .
you may send me the ras.pas to?



i used to use Davide Moretti's one
(though there all quite similar.)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.