Fasnet for Delphi 7 - smtp authentication failed

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)
LVL 1
LeTayAsked:
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.

Eddie ShipmanAll-around developerCommented:
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:
http://www.scalabium.com/mapimail.htm

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:
http://www.delphipages.com/news/detaildocs.cfm?ID=137
http://www.delphipages.com/news/detaildocs.cfm?ID=138
Files:
http://www.delphipages.com/edit/count.cfm?ID=4615

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.


0
LeTayAuthor Commented:
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 ?
0
DragonSlayerCommented:
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
try
  CCList.Add('someone@here.com');
  Subject := 'me@there.com';
  // send here
  idSMTP1.Send(myMessage);
finally
  myMessage.Free;
end;
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Eddie ShipmanAll-around developerCommented:
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:
http://www.projectindy.org/DemoDownloads/Indy9Demos_26Oct04.zip

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


0
LeTayAuthor Commented:
Will try all these tonight (Belgium time !)
If it works as I will, EddieShipman, you get the points !
0
Eddie ShipmanAll-around developerCommented:
There is a sample I did showing how to attach files, in this case an inline bitmap in an HTML email, located here:
http://www.delphipages.com/threads/thread.cfm?ID=106872&G=106849
0
LeTayAuthor Commented:
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...
0
Eddie ShipmanAll-around developerCommented:
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);
var
  add: TIdEMailAddressItem;
begin
  add := AddressList.Add;
  add.Address := AAddress;
  add.Name := AName;
  add.Text := AText;
end;

Usage:  

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???


0
Eddie ShipmanAll-around developerCommented:
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.
0

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
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
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.