Board index » delphi » Examples for SMTP mail with Indy???

Examples for SMTP mail with Indy???

I am using Delphi 5 Pro and have had a fair amount of email programs
done using the TNMSMTP component that is part of the D5 package.
Today I have banged my head against an authentication problem that
seems to be impossible to solve with this component. I need to create
a program that can send a response email via a server that sits behind
a firewall. The server is locked down to stop relaying mail through it
(=spam) and so I need my program to authenticate the SMTP
transactions.
But the TNMSMTP component does not have a property/method to
authenticate other than specifying the UserID *without* a password!

So I find myself forced to switch SMTP component and it seems like the
suite used today is Indy. So I downloaded and installed Indy latest
release 9.something and am now trying to get to grips with it.
Basically I want to just compose my small message and set all needed
properties including the UserID and password and send it off. But I am
baffled by the fact that I cannot find the mailmessage as a property
or a method in the IdSMTP component. How is it done to send an email
with Indy?
Is there any example source code available that shows (in simple
terms) how the component is used to send mail?? Like what is available
in the on-line help for TNMSMTP as 'Example'....

Please, someone send me a hint!

Thanks,

Bo

 

Re:Examples for SMTP mail with Indy???


Quote
"Bo Berglund" <bo.bergl...@telia.com> wrote in message

news:3d3b410f.182115658@forums.borland.com...

Quote
> Basically I want to just compose my small message and set all needed
> properties including the UserID and password and send it off. But I am
> baffled by the fact that I cannot find the mailmessage as a property
> or a method in the IdSMTP component.
> How is it done to send an email with Indy?

----------
// exception handling omitted for brevity...
// ASMTP: TIdSMTP
// AMessage: TIdMessage

ASMTP.Host := sSrvr;
ASMTP.AuthenticationType := atLogin;
ASMTP.Username := sAcct;
ASMTP.Password := sPwd;
ASMTP.Connect(iTimeoutMs);

if ASMTP.Connected then ASMTP.Send(AMessage);
----------

Quote
> Is there any example source code available that shows (in simple
> terms) how the component is used to send mail??

The Indy docs are a little light on embedded example code.

I don't know that they meet your simple criteria, but there are the
MailClient and SMTPRelay demos in the archive downloadable from the Indy
website. (http://www.nevrona.com/Indy/download90.html)

hth...

--
Don Siders [Team Indy]

Visit the Indy Home page for updated source, documentation, and
articles. (http://www.nevrona.com/indy)

Join the Indy Docs project! (http://www.nevrona.com/indy/teams/docs)

ELKNews Free Edition - Empower your News Reader! http://www.atozedsoftware.com

Re:Examples for SMTP mail with Indy???


Thanks,
I will have a look tomorrow (it's way past bedtime here...).
But the examples I downloaded won't compile - maybe they are too old
for a previous Indy version?

Just a quick folowup:
Do I have to do AMessage:= TIdMessage.Create somewhere?

/Bo

On Sun, 21 Jul 2002 20:12:56 -0400, "Don Siders [Team Indy]"

Quote
<side...@att.net> wrote:

>"Bo Berglund" <bo.bergl...@telia.com> wrote in message
>news:3d3b410f.182115658@forums.borland.com...

>> Basically I want to just compose my small message and set all needed
>> properties including the UserID and password and send it off. But I am
>> baffled by the fact that I cannot find the mailmessage as a property
>> or a method in the IdSMTP component.

>> How is it done to send an email with Indy?

>----------
>// exception handling omitted for brevity...
>// ASMTP: TIdSMTP
>// AMessage: TIdMessage

>ASMTP.Host := sSrvr;
>ASMTP.AuthenticationType := atLogin;
>ASMTP.Username := sAcct;
>ASMTP.Password := sPwd;
>ASMTP.Connect(iTimeoutMs);

>if ASMTP.Connected then ASMTP.Send(AMessage);
>----------

>> Is there any example source code available that shows (in simple
>> terms) how the component is used to send mail??

>The Indy docs are a little light on embedded example code.

>I don't know that they meet your simple criteria, but there are the
>MailClient and SMTPRelay demos in the archive downloadable from the Indy
>website. (http://www.nevrona.com/Indy/download90.html)

>hth...

>--
>Don Siders [Team Indy]

>Visit the Indy Home page for updated source, documentation, and
>articles. (http://www.nevrona.com/indy)

>Join the Indy Docs project! (http://www.nevrona.com/indy/teams/docs)

>ELKNews Free Edition - Empower your News Reader! http://www.atozedsoftware.com

Re:Examples for SMTP mail with Indy???


Quote
"Bo Berglund" <bo.bergl...@telia.com> wrote in message

news:3d3b4d1b.185199472@forums.borland.com...

Quote
> Thanks,
> I will have a look tomorrow (it's way past bedtime here...).
> But the examples I downloaded won't compile - maybe they are too old
> for a previous Indy version?

> Just a quick folowup:
> Do I have to do AMessage:= TIdMessage.Create somewhere?

Yes, unless the components are added using the IDE.

--
Don Siders [Team Indy]

Visit the Indy Home page for updated source, documentation, and
articles. (http://www.nevrona.com/indy)

Join the Indy Docs project! (http://www.nevrona.com/indy/teams/docs)

ELKNews Free Edition - Empower your News Reader! http://www.atozedsoftware.com

Other Threads