Fasnet for Delphi 7 - smtp authentication failed

Posted on 2004-11-08
Last Modified: 2007-12-19
I have the FastNet for Delphi 7.
I want now to use it to send emails.
I have used the NMSMTP component, but when sending the mail, I get an exception 'Authentication failed'
I didn't specify any userid, password.
Just the smtp server and port 25.
That's because I already use outlook 2000 and I didn't have to defined id and password.
So what's wrong (I tried all authentication type on the component, all same error)
Question by:LeTay
    LVL 26

    Expert Comment

    You are not going to get much help for using Fastnet controls in Delphi 7. Those controls haven't been
    updated since 1996 and are extremely buggy, ESPECIALLY the authentication.

    The most suggestion you are going to get is to modify your applciation to use Indy, instead, which comes
    already installed in Delphi 7. You have to go to special trouble to install the Fastnet controls, right?

    In order to send email, you must have an smtp account, which normally would include a userid and a password.
    You MUST know those values before you can use smtp to send using ANY smtp control.

    If you want to send using your Outlook engine, use MAPI. Try Mike Shklonik's freeware Mapi controls here:

    Beware that you will also be required to have a userid and password to use them.

    If you want another solution, you can use the techniques outlined in my Hotmail--Delphi Style! article here:

    I use this for support emails from within my applciations. I setup a Hotmail account and then email messages to myself
    using my own Hotmail account instead of having to ask the user their userid and password.


    Author Comment

    I will try using Indy as you suggests
    Looking in a first shot at its SMTP component, I do not see anything like To:, CC:, subject, content, attachments etc...
    Were are these ?
    LVL 14

    Expert Comment

    You can either

    1. Call the QuickSend method and supply all the parameters, OR
    2. Create a TIdMessage instance, put in all the necessary info, and then call Send, e.g.

    myMessage := TIdMessage.Create(nil);
    with myMessage do
      Subject := '';
      // send here
    LVL 26

    Expert Comment

    In Indy, The TidMessage is where youy set these types of values.
    TidSMTP only handles the conenctions and sending of the message.

    You have BCCList, CCList, and Recipients properties.

    Remember, you will also need a user and password for the SMTP
    account you are attempting to send from. There is a demo of
    using TidSMTP in the Indy demos located here:

    I would suggest uninstalling Indy8, which is installed with Delphi7 and installing Indy9
    available here:

    Help files located here:


    Author Comment

    Will try all these tonight (Belgium time !)
    If it works as I will, EddieShipman, you get the points !
    LVL 26

    Expert Comment

    There is a sample I did showing how to attach files, in this case an inline bitmap in an HTML email, located here:

    Author Comment

    I succeed sending one message, but I am not familiar at all with the 'normal' way to specify  the To: addresses and the From: as these seem to use TidEmailAddressItem
    If you have just a few lines of example of how to define for example 2 addressees, says and ?
    I used currently the .recipients.emailaddreses := ';' but I suppose there is a nicer way...
    LVL 26

    Expert Comment

    It is easier to think of the Recipients, BCCList and CCList as collections, which they actually are.

    Each Item in these lists have three properties, Address, Name, and Text.

    I usually do it like this:

    procedure AddEmailAddress(var AddressList: TIdEMailAddressList; AAddress, AName, AText: String);
      add: TIdEMailAddressItem;
      add := AddressList.Add;
      add.Address := AAddress;
      add.Name := AName;
      add.Text := AText;


    AddEmailAddress(idMessage1.Recipients, '', 'Eddie Shipman', 'Eddie Shipman <>');

    Much easier to use don't you think???

    LVL 26

    Accepted Solution

    Now, From and Sender, are TidEmailAddressItems, not lists so you address them like this:

    idMessage1.From.Address := '';
    idMessage1.From.Name    := 'Eddie Shipman';
    idMessage1.From.Text      := 'Eddie Shipman <>');

    The ReplyTo is the same as Recipients, CCList, etc. so you can use the AddEmailAddress procedure to
    add to it.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video discusses moving either the default database or any database to a new volume.

    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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now