Reply to e-mail with history & without attachments

Is there an easy way to reply to an e-mail with history, but without any attachments? This would also apply to "reply with history to all" e-mails.

View member feedback to this Ask the Expert Q&A.

Get a handle to the document you want to reply to and delete any attachments (don't save the document) then create the response. Some sample code follows.

Set db = session.currentDatabase 
Set docProfile = db.GetProfileDocument
Set doc = session.DocumentContext 
Set uidoc = ws.EditDocument(False, doc)
Set doc = uidoc.document  
Call uidoc.close
strErrMsg = "Memo format prevents the 
attachment(s) from being removed."
intReplyToAll = (docProfile.Action(0) = "ReplyToAll")
intStandardReply = True            
If doc.HasEmbedded = True Then   
 Set item=doc.getFirstItem("body") 
 If (item Is Nothing) Then 
 Messagebox strErrMsg, MB_ICONEXCLAMATION, 
"Cannot Remove Attachment
  If Isempty(item.embeddedObjects) Then
   Messagebox strErrMsg, MB_ICONEXCLAMATION, 
Remove Attachment(s)."
   Forall x In item.embeddedObjects
    If x.type = EMBED_ATTACHMENT  Then        
'is there an attachment 
     intStandardReply = False
     Exit Forall
    End If
   End Forall  
  End If
End If
End If
If intStandardReply Then  'do a normal 
reply with history
 If intReplyToAll Then
  Call session.SetEnvironmentVar( "MailStEd", "9" )
 End If
 Call ws.ComposeDocument
("","","Reply With History")
Else   'get rid of attachments from 
background document  
 Set tempdoc = New NotesDocument(db)  
 Set item=doc.getFirstItem("body") 
      'Set up RichTextStyle
 Set richStyle = session.CreateRichTextStyle
 richStyle.NotesFont = FONT_HELV 
 richStyle.FontSize = 8
 richStyle.NotesColor = COLOR_DARK_MAGENTA
 Call item.AppendStyle(richStyle)
 Call item.AddNewLine(2)
 Call item.AddNewLine(1)
 Forall Attach_File In item.embeddedObjects
  If Attach_File.Type = EMBED_ATTACHMENT Then
   strFilename = Attach_File.Source
   Call item.Appendtext("<< Attachment Removed : " 
+ strFilename$ + " >>")
   Call item.AddNewLine(1)
  End If
 End Forall
 Call doc.CopyAllItems(tempdoc,True)
 Call tempdoc.MakeResponse( doc)
 Call tempdoc.Save(True,False)
      'open the tempdoc using the new memo form 
and create a reply with 
 Set tempuidoc = ws.EditDocument(True,tempdoc)
 If intReplyToAll Then
  Call session.SetEnvironmentVar( "MailStEd", "9" )
 End If
 Set anotheruidoc = ws.ComposeDocument
("","","Reply With History")
 Set refitemintempdoc = tempdoc.
 Set refitem = refitemintempdoc.
 Call tempuidoc.close
 Call tempdoc.Remove(True)  
End If


I have a much simpler solution -- upgrade to Notes 6.5. It has been out for quite some time and has this functionality built into the template.

—Brian P.

Do you have comments on this Ask the Expert question and response? Let us know.

This was last published in March 2005

Dig Deeper on Lotus Notes Domino Application Development

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...