Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Indy - Sending Attachment in email


This question is answered.


Permlink Replies: 6 - Last Post: May 26, 2017 2:12 PM Last Post By: Remy Lebeau (Te...
Barry Wood

Posts: 73
Registered: 9/3/01
Indy - Sending Attachment in email  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 5, 2017 8:14 AM
Hi

I'm trying to send an attachment with an email using Indy.

I've seen in several places to use: TidAttachmentFile.Create( ...Messageparts..., ...attacjment... ); but all I get is 'undeclared identifier. I'm unsure which component this function resides in or if it's an old one no longer in Delphi 10?

Can anyone provide a way to use Indy to send an attachment?

Later: I've found answer!! Add IdMessage to Uses. Shudda searched better first time :-)

Edited by: Barry Wood on Mar 5, 2017 8:49 AM
Antonio Estevez

Posts: 665
Registered: 4/12/00
Re: Indy - Sending Attachment in email [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 5, 2017 9:23 AM   in response to: Barry Wood in response to: Barry Wood
El 05/03/2017 a las 17:51, Barry Wood escribió:
Hi

I'm trying to send an attachment with an email using Indy.

I've seen in several places to use: TidAttachmentFile.Create( ...Messageparts..., ...attacjment... ); but all I get is 'undeclared identifier. I'm unsure which component this function resides in or if it's an old one no longer in Delphi 10?

Can anyone provide a way to use Indy to send an attachment?

Later: I've found answer!! Add IdMessage to Uses. Shudda searched better first time :-)


uses
   ..., IdAttachmentFile, ...;
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Indy - Sending Attachment in email [Edit]
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 6, 2017 11:38 AM   in response to: Barry Wood in response to: Barry Wood
Barry wrote:

I've seen in several places to use: TidAttachmentFile.Create(
...Messageparts..., ...attacjment... ); but all I get is 'undeclared
identifier.

Did you add the 'IdAttachmentFile' unit to your 'uses' clause?

I'm unsure which component this function resides in

None, because TIdAttachmentFile is not a component, it is just a utility
class.

or if it's an old one no longer in Delphi 10?

It is not an old class.

Later: I've found answer!! Add IdMessage to Uses.

That will resolve any references to the TIdMessage component, but not to
the TIdAttachment... classes. They reside in their own units (IdAttachmentMemory.pas,
IdAttachmentFile.pas, etc), which you will have to also add to your 'uses'
clause as needed.

--
Remy Lebeau (TeamB)
David Guest

Posts: 1
Registered: 7/7/07
Re: Indy - Sending Attachment in email  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 26, 2017 6:20 AM   in response to: Barry Wood in response to: Barry Wood
Could somebody please show me the line of code which attaches an attachment to an Indy message that is going to be sent by smtp?

thank you...

Barry Wood wrote:
Hi

I'm trying to send an attachment with an email using Indy.

I've seen in several places to use: TidAttachmentFile.Create( ...Messageparts..., ...attacjment... ); but all I get is 'undeclared identifier. I'm unsure which component this function resides in or if it's an old one no longer in Delphi 10?

Can anyone provide a way to use Indy to send an attachment?

Later: I've found answer!! Add IdMessage to Uses. Shudda searched better first time :-)

Edited by: Barry Wood on Mar 5, 2017 8:49 AM
Robert Evans

Posts: 114
Registered: 10/16/99
Re: Indy - Sending Attachment in email  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 26, 2017 7:07 AM   in response to: David Guest in response to: David Guest
In article <919882 at forums dot embarcadero dot com>, David Guest <?@?.?.invalid>
wrote
Could somebody please show me the line of code which attaches an
attachment to an Indy message that is going to be sent by smtp?

If you are new to Indy then a good starting point is:
http://www.indyproject.org/Sockets/Docs/Articles.EN.aspx

There is also much wisdom to be gained from perusing the annals of
embarcadero.public.delphi.winsock

--
Bob Evans
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: Indy - Sending Attachment in email  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 26, 2017 7:27 AM   in response to: David Guest in response to: David Guest
David Guest wrote:

Could somebody please show me the line of code which attaches an
attachment to an Indy message that is going to be sent by smtp?

thank you...

Check out
http://www.indyproject.org/sockets/blogs/rlebeau/2005_08_17_a.en.aspx
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Indy - Sending Attachment in email  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 26, 2017 2:12 PM   in response to: David Guest in response to: David Guest
David Guest wrote:

Could somebody please show me the line of code which attaches an
attachment to an Indy message that is going to be sent by smtp?

You already know what is needed, as it is stated in the same text you
quoted from Barry Wood's message:

I've seen in several places to use: TidAttachmentFile.Create(
...Messageparts..., ...attacjment... );

Constructing a TIdAttachment... object (TIdAttachmentFile,
TIdAttachmentMemory, etc) with the TIdMessage.MessageParts property as
its collection will attach the object to the email.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02