Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to work with $FILE attachments and I cannot access them

I have an incoming email (mail-in db) that contains a RichTextField where "some" attachments are found. I am also finding attachments not in the RTF but in the Document as $FILE. I am trying to get a handle on all the objects to copy them to another outgoing email. I can find the $FILE using the code below.

 Dim rtiObject as NotesEmbeddedObject
 Dim rti_Email as NotesRichTextItem
 Dim obj_Email as NotesEmbeddedObject
 ForAll p in mailDoc.items
   if p.Name = "$FILE" then
     set obj_Email = mailDoc.GetAttachment(p.Values(0)) 'this will return the Name of the attachment (or file)
     set rtiObject = rti_Email.EmbedObject( EMBED_ATTACHMENT, "", obj_Email.Name) 'this is supposed to attach the file to the document's RTF
   End If
 End ForAll

When this script runs it finds the $FILE files and returns the name but not the object and I cannot do anything with it from there.

What do I need to do to get the attachment/object ($FILE) from the original doc and attach it to an RTF in the outgoing email?

I thought about detaching the attachment to the network and then attaching it to the outgoing email and then deleting the attachment from the network but that seems impractical.

Is there a better way to handle these $FILE type of attachments on the incoming email that would make this easier?

like image 467
RoyRumaner Avatar asked May 15 '12 14:05

RoyRumaner


People also ask

Why can't I open some email attachments?

Unrecognized file format One of the most common reasons why you can't open an e-mail attachment is because your computer doesn't have the necessary program installed to recognize the file format.

Why is my email blocking attachments?

To help protect you and your recipients against computer viruses, Outlook blocks the sending and receiving of certain types of files (such as .exe and certain database files) as attachments.

How do you open an attachment received in your mail?

Open an attachmentIn the message list, select the message that has the attachment. In the Reading Pane, double-click the attachment. You can also right-click the message that has the attachment and choose View Attachments.


1 Answers

Try the EmbeddedObjects property of the NotesDocument object. Something like this:

Forall obj_Email in MailDoc.EmbeddedObjects
  If obj_Email.Type = EMBED_ATTACHMENT then
    Call obj_Email.Extract(sometempdirectory$ & obj_Email.Name)
    Call rti_Email.EmbedObject(EMBED_ATTACHMENT, "", sometempdirectory$ & obj_Email.Name)
End Forall

You can also do it without detaching if you wish.

like image 153
Rob Darwin Avatar answered Sep 23 '22 22:09

Rob Darwin