Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages
Started by dave
Fri, 05 Jan 2007 13:26
Using Indy components to send email...but want to attach files
Author: dave
Date: Fri, 05 Jan 2007 13:26
Date: Fri, 05 Jan 2007 13:26
19 lines
1387 bytes
1387 bytes
I am using Indy components to send emails. I would like to attach anywhere from 0 to 7 files to these emails. My current code looks like: IdSMTP_Release_Notes->Connect(); IdMessage_Release_Notes->From->Text = "ddd@hhhh.net"; IdMessage_Release_Notes->Recipients->EMailAddresses = "test@hhhh.net"; IdMessage_Release_Notes->Body->Text = "Mail BODY Message Here"; IdMessage_Release_Notes->Subject = "Mail subject!!!!"; IdSMTP_Release_Notes->Send(IdMessage_Release_Notes); IdSMTP_Release_Notes->Disconnect(); What would the code look like if I were to attach several files to this email I am sending out? ---Dave
Re: Using Indy components to send email...but want to attach files
Author: Remy Lebeau (TeamB)
Date: Fri, 05 Jan 2007 18:09
Date: Fri, 05 Jan 2007 18:09
38 lines
2089 bytes
2089 bytes
"dave" <dave@hhhh.net> wrote in message
news:459e5222$1@newsgroups.borland.com...
> I am using Indy components to send emails. I would like to attach
anywhere from 0 to 7 files to these emails.
You need to use the TIdMessage::MessageParts collection for that.
> My current code looks like:
Use this code instead:
IdMessage_Release_Notes->Clear();
IdMessage_Release_Notes->From->Name = "Me";
IdMessage_Release_Notes->From->Address = "ddd@hhhh.net";
IdMessage_Release_Notes->Recipients->EMailAddresses =
"test@hhhh.net";
IdMessage_Release_Notes->Subject = "Mail subject!!!!";
IdMessage_Release_Notes->Body->Text = "Mail BODY Message Here";
if( NumberOfAttachments > 0 )
{
for(int i = 0; i < NumberOfAttachments; ++i)
{
TIdAttachment *Attachment = new
TIdAttachment(IdMessage_Release_Notes->MessageParts, "FileName Here");
Attachment->ContentType =
GetMimeTypeFrmFile(Attachment->FileName);
// set other properties as needed ...
}
IdMessage_Release_Notes->ContentType = "multipart/mixed";
}
else
IdMessage_Release_Notes->ContentType = "text/plain";
Gambit
Re: Using Indy components to send email...but want to attach files
Author: dave
Date: Fri, 05 Jan 2007 20:23
Date: Fri, 05 Jan 2007 20:23
49 lines
2334 bytes
2334 bytes
Thats great!
Many thanks!
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"dave" <dave@hhhh.net> wrote in message
>news:459e5222$1@newsgroups.borland.com...
>
>> I am using Indy components to send emails. I would like to attach
>anywhere from 0 to 7 files to these emails.
>
>You need to use the TIdMessage::MessageParts collection for that.
>
>> My current code looks like:
>
>Use this code instead:
>
> IdMessage_Release_Notes->Clear();
> IdMessage_Release_Notes->From->Name = "Me";
> IdMessage_Release_Notes->From->Address = "ddd@hhhh.net";
> IdMessage_Release_Notes->Recipients->EMailAddresses =
>"test@hhhh.net";
> IdMessage_Release_Notes->Subject = "Mail subject!!!!";
> IdMessage_Release_Notes->Body->Text = "Mail BODY Message Here";
>
> if( NumberOfAttachments > 0 )
> {
> for(int i = 0; i < NumberOfAttachments; ++i)
> {
> TIdAttachment *Attachment = new
>TIdAttachment(IdMessage_Release_Notes->MessageParts, "FileName Here");
> Attachment->ContentType =
>GetMimeTypeFrmFile(Attachment->FileName);
> // set other properties as needed ...
> }
> IdMessage_Release_Notes->ContentType = "multipart/mixed";
> }
> else
> IdMessage_Release_Notes->ContentType = "text/plain";
>
>
>Gambit
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads