AllExperts > Experts 
Search      

Using Lotus Notes

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Using Lotus Notes Answers
Question Library

Ask a question about Using Lotus Notes
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Paski K. Paskaradevan
Expertise
I have 3 + years in Lotus Notes application development. I am a CLP R5 Application Development. I can answer any question pertaining to application development.

Experience
R5 CLP. In addition, I have a bachelors degree in Engineering and a MBA.
 
   

You are here:  Experts > Internet/Online > Email > Using Lotus Notes > Attachments are not being sent in Lotusscript email script.

Topic: Using Lotus Notes



Expert: Paski K. Paskaradevan
Date: 6/18/2008
Subject: Attachments are not being sent in Lotusscript email script.

Question
I have a button to send e-mail which contains richtext field on a form. When users put attachments in the fields, sometimes the attachments do not appear in the e-mail that was sent. Here is the code that we are using.

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim workspace As New NotesUIWorkspace
  Dim view As NotesView
  Dim doc As NotesUIDocument
  Dim docA As NotesDocument
  Dim docB As NotesDocument
  Dim rtitem As NotesRichTextItem
  Dim item As NotesItem
  Dim item2 As NotesItem
  Dim item3 As NotesItem
  Dim item4 As NotesItem
  Dim item5 As NotesItem
  Dim Subject As NotesItem
  Dim success As Variant
  Set db = session.CurrentDatabase
  Set doc = workspace.CurrentDocument
  
  
  Call doc.Save
  Set docA = doc.Document
  Call docA.Save( True, True )
'   Call doc.Categorize("Tempdoc")
  Set item = DocA.GetFirstItem("SendTo")
  Set item2 = DocA.GetFirstItem("Subject")
  Set item3 = DocA.GetFirstItem("CopyTo")
  Set item4 = DocA.GetFirstItem("BlindCopyTo")
  Set docB = New NotesDocument( db )
  Success = docB.ComputeWithForm(False, False)
  Set rtitem = New NotesRichTextItem( docB, "Body" )
  Call docB.Save( True, True )
  success = docA.RenderToRTItem( rtitem )
  Call docB.Save( True, True )
  
  If DocA.HasItem("GatewayName") Then
     Set item5 = DocA.GetFirstItem("GatewayName")
     Call docB.CopyItem(item5, "SendTo" )
     Set Subject = New NotesItem(DocB,"Subject","ES_TAOForm-from-Notes")
     Call DocB.Save(True,True)
  Else
     Call docB.ReplaceItemValue("SendTo",item )
     Call docB.ReplaceItemValue("DisplayDatabase",item )
     Call docB.ReplaceItemValue("Subject", item2)
     If DocA.HasItem("CopyTo") Then
        Call docB.ReplaceItemValue("CopyTo", item3 )
     End If
     If DocA.HasItem("BlindCopyTo") Then
        Call docB.ReplaceItemValue("BlindCopyTo", item4 )
     End If
  End If
  
  DocB.SignOnSend = True
  DocB.SaveMessageOnSend = True
  Call docb.Send(False)
  Call doc.Close
  Call DocB.Remove(True)
End Sub

Answer
Hi,

All you need to do is after the attachment is added to the uidocument, save the uidocument and then send it. Looks like you alreday have the sendto, copyto fields etc. on the form and the uidocument will be sent to those specified in those fields.

Your code as written is doing unnecessary things (like transferring items from doca to docb etc.). Computewithform is totally unnecessary.

Write a very simple code and SAVE the document before sending it.

Regards.

Paski  

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.