Fasnet for Delphi 7 - smtp authentication failed

Posted on 2004-11-08
Medium Priority
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
  • 5
  • 3
LVL 26

Expert Comment

by:Eddie Shipman
ID: 12533782
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

ID: 12534078
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

ID: 12534419
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 := 'me@there.com';
  // send here
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 26

Expert Comment

by:Eddie Shipman
ID: 12534736
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: http://www.indyproject.org/indy/downloads/Indy_9_00_17_src.zip

Help files located here: http://www.indyproject.org/indy/downloads/Indy-9-0-Help-WinHelp.zip


Author Comment

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

Expert Comment

by:Eddie Shipman
ID: 12537994
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

ID: 12543572
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 a@site1.com and b.site2.com ?
I used currently the .recipients.emailaddreses := 'a@site1.com;b.site2.com' but I suppose there is a nicer way...
LVL 26

Expert Comment

by:Eddie Shipman
ID: 12544422
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, 'mr_delphi_developer@yahoo.com', 'Eddie Shipman', 'Eddie Shipman <mr_delphi_developer@yahoo.com>');

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

LVL 26

Accepted Solution

Eddie Shipman earned 2000 total points
ID: 12544448
Now, From and Sender, are TidEmailAddressItems, not lists so you address them like this:

idMessage1.From.Address := 'mr_delphi_developer@yahoo.com';
idMessage1.From.Name    := 'Eddie Shipman';
idMessage1.From.Text      := 'Eddie Shipman <mr_delphi_developer@yahoo.com>');

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

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

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…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

840 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