Article View: borland.public.cppbuilder.internet.socket
Article #1486Re: Using Indy components to send email...but want to attach files
From: 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
>
>
Technical Details
Message-ID:
<459eb3ae$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<459e5222$1@newsgroups.borland.com> <459e943c$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,91daf0a133c0a136 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "dave" <dave@pop.com> Sender: "dave" <dave@pop.com> Reply-To: "dave" <dave@pop.com> Subject: Re: Using Indy components to send email...but want to attach files Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 209.113.245.98 References: <459e5222$1@newsgroups.borland.com> <459e943c$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <459eb3ae$1@newsgroups.borland.com> Date: 5 Jan 2007 12:23:10 -0800 X-Trace: newsgroups.borland.com 1168028590 207.105.83.66 (5 Jan 2007 12:23:10 -0800) Lines: 50 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail