email attachments with Indy [Edit]

Hello -

In former days with Delphi 7 I used the standard  

     TIdAttachment.Create(IdMessage1.MessageParts, 'C:\MyFile.com');

to send an attachment with my email.  Now with D2010 and Indy 10.5.5 I can get the email to work as well as ever, but I am unable to get the attachment to work.

I have searched extensively and have tried various things such as  Attachment := TIdAttachmentFile.Create(IdMessage1.MessageParts, 'C:\MyFile.com') and 

with TIdAttachment(IdMessage1.MessageParts) do
   begin 
   ContentType := 'text/plain';
   ParentPart := -1;
   FileName :=  'C:\MyFile.com';
   end;

and others.  None has worked and I'm wondering what has changed and what is required to perform what used to be a simple operation.  Maybe I don't have the uses correct.

Anyone can tell me what will send one (or more) attachment through Indy?  Thanks in advance.

M

Edited by: Mark Naples on Oct 5, 2010 6:17 AM
found it - didn't have the IdAttachment file in uses.  thanks to all for input.
0
Mark
10/5/2010 1:18:34 PM
embarcadero.delphi.oodesign 456 articles. 0 followers. Follow

1 Replies
773 Views

Similar Articles

[PageSpeed] 4

<Mark Naples> wrote in message news:294198@forums.embarcadero.com...

> In former days with Delphi 7 I used the standard
>
>     TIdAttachment.Create(IdMessage1.MessageParts, 'C:\MyFile.com');
>
> to send an attachment with my email.  Now with D2010
> and Indy 10.5.5 I can get the email to work as well as ever,
> but I am unable to get the attachment to work.

TIdAttachment was changed into an abstract base class in Indy 10.  You need 
to instantiate one of its descendant classes now, in this case that would be 
TIdAttachmentFile:

{code:delphi}
uses
  IdAttachmentFile;

TIdAttachmentFile.Create(IdMessage1.MessageParts, 'C:\MyFile.com');
{code}

-- 
Remy Lebeau (TeamB)
0
Remy
10/5/2010 4:39:48 PM
Reply:

Similar Artilces:

[Indy] Retrieve attachments from email accounts [Edit]
Hi, I tried to retrieve attachments list from some email accounts (gmail and my own), using both TidPop3 and TidIMAP4: [POP3] .... {code} MsgCont := POP3.CheckMessages; if MsgCont > 0 then begin for i := 1 to MsgCont do begin msg := TIdMessage.Create; if POP3.RetrieveHeader(i,msg) then begin TheEmail := lvEmail.Items.Add; TheEmail.Caption := msg.From.Address; TheEmail.SubItems.Add('No'); msg.MessageParts.CountParts; if...

Problem with email attachments using Indy SMTP [Edit]
Can anyone tell me if something is wrong with the way I'm adding the html content or the attachment in the code fragment below? (Is this the right place for Delphi/Indy questions?) I have used this routine extensively. It seemed to work. Have recently discovered that Outlook recipients don't see html properly when an attachment is present. With no attachment, html content shows up in body of email as expected. If an attachment is present then the body is empty and there are two attachments, the intended one plus a .htm file containing the content. Is fine in gmail, yahoo, hot...

Converting Delphi 2007 Indy 10.2.3 to Delphi 2009 Indy 10.5.5 [Edit]
Hello, I am currently attempting to port over a Delphi 2007 project that uses Indy 10.2.3 (very successfully) to Delphi 2009 and Indy 10.5.5 (I just got the latest development build this morning). I think I am running into an encoding issue, but am not sure. Specifically, IDHTTP with SSL calls an old CGI and the CGI returns a .zip file and I then save it to the disk. In 2007 and before this worked perfectly. In 2009, it is not. Here is the examples of the 2 different results (though cut way short in the post) I am getting back: 2007: 'PK'#3#4#$14#0#0#0#8#0'rLQ9žrPb€'#0...

Problems sending emails with attachments in Indy SMTP in Delphi 2009
Hi, I'm working with Delphi 2009 fully updated (12.0.3420.21218 with Update Pack 3), and I had the original version of the Indy 10.2.5. All attachments were going with a file name ATT000043.dat, instead of the correct name. I updated to the latest Indy from the Dev Snapshot, and it went to version 10.5.7. However, now the attachment does not appear as an attachment at all, the the message appears as: This is a multi-part message in MIME format --HF2WOHttwwLp1TZg=_wwY6H2qbRC0RDTyU Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-Disposition: inline H...

Delphi XE5 Android App dies preparing INDY email [Edit]
Can someone help me with the following code, it connects and authenticates the idsmtp connection but the app dies on the line:- idMessage1.Recipients.EMailAddresses:='colin@gmail.com'; Anyone had and overcome this problem? procedure TForm3.Button1Click(Sender: TObject); begin if idSMtp1.Connected = true then idsmtp1.Disconnect; idsmtp1.Connect; //THIS LINE WORKS idSmtp1.Authenticate; //THIS LINE WORKS idMessage1.Clear; //THIS LINE WORKS ...

Attaching emails as email attachments
Hi, Is this possible? I want to be able to attach a number of emails to another email and send it. A bit like you can do in Outlook where you can just drag the emails you want to send into the new email - they then appear as attachments with the envelope icon. I can attach other kinds of file without any problems, that all works fine. It's just attaching emails that's proving to be a problem. I'd like to do something like this: Dim oldEmail1 As New MailMessage(oldMailFrom1, oldMailTo1, oldSubject1, oldBody1) Dim oldEmail2 As New MailMessage(oldMailFrom2, oldMa...

Print all email attachments (including sub emails and their attachments)
--____OBYWTHBCXVXOFGPGVPTL____ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 Content-Disposition: inline; modification-date="Wed, 31 Aug 2010 07:20:44 -0400" QW55IHdheSB0byBwcmludCBhbGwgZW1haWwgYXR0YWNobWVudCBOQU1FUyBvbmx5IChpbmNsdWRp bmcgYW55IHN1YiBlbWFpbHMgYW5kIHRoZWlyIGF0dGFjaG1lbnRzKSBhbGwgYXQgb25jZSA/Pz8= --____OBYWTHBCXVXOFGPGVPTL____ Content-Type: multipart/related; boundary="____UDFRXZIVSCHQTEJGXAIR____" --____UDFRXZIVSCHQTEJGXAIR____ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 Content-Dis...

email attachments not attaching
I am authoring a simple online application form which allows a user to upload cover letter and/or resume. The files are then stored in a database and also emailed to the correct person as attachments. The files are being stored in the database with no problems but they are not being attached to the email properly. Below is the snippet of the code used to attach the files and send the mail:// Create the mail message System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("noreply@mydomain.com", OfficeEmailHiddenField.Value, "Application", message); mail.IsBody...

Retrieve Attachments From Email ( Indy )
Hi, can you show me some example code how to use indy 9 in delphi 7 to retrieve attachments from email account ? eddy wrote: > Hi, can you show me some example code how to use indy 9 in > delphi 7 to retrieve attachments from email account ? Code examples are readily available online in various forums, blogs, etc. A simple web search should be able to find them. All you have to do is download an email into a TIdMessage component using TIdPOP3.Retrieve() or TIdIMAP4.Retrieve() (depending on which protocol you are using to access the account) and then loop through the TI...

Can't ready the email attachments which are inside email attachments.
Please tell me this can be fixed. In Thunderbird, when I get an email attachment and open it, it works fine. The email attachment opens and I can read it. However, if that email attachment has an email attachment inside it, it doesn't work. Thunderbird will not allow me to open the email attachment inside the email attachment. If I go over to Outlook and get it there everything works fine. I switched over to Thunderbird, because Outlook was pulling two and three copies of every email in my POP accounts. But if I have to choose between Outlook downloading multiple c...

TIdTraceRoute indy delphi xe2 [Edit]
i need trace the route of an ip, actually i am using the TIdTraceRoute indy component from the idTraceRoute unit. (delphi xe2) IdTraceRoute1:= TIdTraceRoute.Create(Self); IdTraceRoute1.ResolveHostNames:= True; IdTraceRoute1.ReceiveTimeout:= 5000; IdTraceRoute1.OnReply:= TraceRoute; IdTraceRoute1.Host:= 'www.google.com';//OR 172.16.0.13 (INTRANET IP) IdTraceRoute1.Trace; procedure TForm1.TraceRoute(ASender: TComponent; const AReplyStatus: TReplyStatus); begin Memo1.Lines.Add(AReplyStatus.FromIpAddress); end; but always return. 0.0.0.0 0....

Send Email with Indy and SSL [Edit]
I must send a mail with Indy 10.0.1.1 and SSL This is my code: procedure SendEmail; var IdMessage: TIdMessage; SMTP: TIdSMTP; SSLHandler: TIdSSLIOHandlerSocketOpenSSL; IdUserPassProvider: TIdUserPassProvider; IdSASLCRAMMD5: TIdSASLCRAMMD5; IdSASLCRAMSHA1: TIdSASLCRAMSHA1; IdSASLPlain: TIdSASLPlain; IdSASLLogin: TIdSASLLogin; IdSASLSKey: TIdSASLSKey; IdSASLOTP: TIdSASLOTP; IdSASLAnonymous: TIdSASLAnonymous; IdSASLExternal: TIdSASLExternal; begin IdMessage := TIdMessage.Create(nil); try IdMessage.ContentType := 'text/plain'; IdMes...

sending emails with attachement delphi 2009
Hi, I have a problem, I'm using delphi 2009, I made a small application that uses TIdsmtp to send mails, for attachments I'm using TIDAttachmentFile class, like with TIdAttachmentFile.Create(IdMessage1, 'c:\image1.jpg') do begin ContentType := 'image/jpeg'; FileName := 'image1.jpg'; end; SMPT.send(IdMessage1); If I dont use attachment it works fine, but with attachemtns I'm getting email with some dummy name for attachemnt like ATI1284765.dat (if I change file extension to jpg it's ok then, it's that pictu...

Email with attachment and HTML email
Hi all, I know to use the Net::SMTP module, but I would like to send an email which has a fiew file attached and to be an HTML type because I want to include an image in it. Do you know which perl module can help me doing that? Thank you. Octavian Rasnita wrote: > I know to use the Net::SMTP module, but I would like to send an email which > has a fiew file attached and to be an HTML type because I want to include an > image in it. > > Do you know which perl module can help me doing that? Try Mail::Sender. -- Greg -------------------------------...

Web resources about - email attachments with Indy [Edit] - embarcadero.delphi.oodesign

Attachment in adults - Wikipedia, the free encyclopedia
Attachment in adults deals with the theory of attachment in adult romantic relationships. Attachment theory was extended to adult romantic relationships ...

Facebook Allowing Page Admins To ‘Refresh Share Attachment?’
Facebook appears to have given page administrators the option of refreshing links that they share in posts on their pages . continued... New ...

Chronik-Fotos - Mama Bean - Unconditional Attachment - Facebook
Graphic design students at the University of North Texas asked this inspiring mama, Monica, to be the face of their ad campaign. The campaign ...

New Facebook Messages Only Provides an Online Attachment Viewing Feature for Microsoft Docs
In another move highlighting Facebook’s strategic relationship with investor Microsoft, the company has given the established office software ...

Documents.me - Documents from remote PC, MAC, Gmail attachments, Google Drive & Dropbox Docsync for iPad ...
Get Documents.me - Documents from remote PC, MAC, Gmail attachments, Google Drive & Dropbox Docsync on the App Store. See screenshots and ratings, ...

A bullet attachment that could save lives? - YouTube
It looks like a toy attachment for a gun, but this new device is intended to give suspects a chance to live if shot. CNN's Sara Sidner reports. ...

Invention of the Day: New ‘Alternative’ Gun Attachment May Prevent Shooting Deaths
The Ferguson Police Department is testing out a new device which they think might help prevent unnecessary shooting deaths. “The Alternative” ...

100th anniversary of Anzac landings brings home strong attachments
The commemoration of the 100th anniversary of the Anzac landings draws our attention to events that so many of us have a strong attachment to. ...

iPhones - Is Our Attachment To Smartphones A Bad Thing?
They cater to our basic human hunger for connection, so is our attachment to mobiles such a bad thing?

Apple not encrypting email attachments in iOS 7, security researcher claims
Apple's Mail app in iOS 7 is failing to encrypt email attachments, leaving user data vulnerable to hackers, a security researcher claims.

Resources last updated: 12/14/2015 2:17:09 PM