Send a Form as an Email

Hi,

I have created a button with the on-click property set to email a certain user. In this email however, I wanted to include a form that the user can fill out and reply back with. This way I can access and extract the information with an agent.

Is this possible? and if so, how would I go about doing it?

thanks,

Nima

Subject: Send a Form as an Email

In order to send a Lotus Notes Form via email, first, the database must be setup to "Allow use of stored forms in database(Database Properties, 1st tab, look at checkboxes at the bottom)…Next, on the Form Properties, 1st tab, in the Options area, be sure Store form in document is checked on. By storing the form in the document though, this takes up a considerable amount more room(database size increases much more with this option)…Of course this all depends on how many forms you actually send.

Suggestion, within the email you send, insert a link with code to go to the server/database and @Command([Compose];“formname”)…

Now, if you are talking about sending an attachment(Microsoft Word Form), I have done this before by creating a new form and view and then I store the attachment in that form and view…Within your code, you would then have it point to that view, pull out the attachment, paste it into the email and then send the email…I am hoping I can find the code so I can post another response to further help you out…

HTH

Subject: Send a Form as an Email - code to email attachment

I had this as an agent to run from Actions Menu…I created a form, Attach Form, with a single field, AttachField(rich text)…I then created a view, (Attach View), hidden, that only stores the Attach Form wth 1 column that has the value of Last Modified. The agent then goes into the users email, appends the Subject, some text to the Body and the attachment within the (Attach View)…

HTH


Sub Initialize

Dim session As New NotesSession, db As NotesDatabase, Aview As NotesView

Dim doc As NotesDocument, rtitem As NotesRichTextItem, DataDir As String

Dim object As NotesEmbeddedObject, Adoc As NotesDocument



Set db = session.CurrentDatabase



 'This retrieves their data directory from their notes.ini file and puts in a backslash

DataDir = session.GetEnvironmentString("Directory", True) & "\"



 'THIS FILE NAME MUST MATCH THE NAME OF THE FILE IN THE ATTACH VIEW

Const TheFileName = "Circle.doc"



Set Aview = db.GetView("(Attach View)")

Set Adoc = Aview.GetFirstDocument

Set object = Adoc.GetAttachment(TheFileName)



 'This detaches the file to their hard drive in their notes data directory

Call object.ExtractFile(DataDir + TheFileName)



Set doc = New NotesDocument(db)     

doc.Form = "Memo"     

Set rtitem = New NotesRichTextItem(doc, "Body")

Call rtitem.AppendText("Here is the Circle of Commitment Sheet.  Please launch or detach this attachment and print it off.")

Call rtitem.AddNewLine(1)

Call rtitem.AppendText("Use this circle to indicate how you spend your time.  Please be as creative as possible.")

Call rtitem.AddNewLine(1)

Call rtitem.AppendText("There is no wrong way to respond to this question.  Your completed circle must be brought to your first interview.")

Call rtitem.AddNewLine(2)

Call rtitem.AppendText("Starting Monday, January 26, 2004, candidates must visit 64 Duffy Hall; Housing and Residence Life between 9am - 5pm Monday - Friday to sign-up for their first interview.  Please sign-up for an interview no later than Thursday, February 6, 2003.")

Call rtitem.AddNewLine(1)

Call rtitem.AppendText("You should plan to sign-up as soon as possible but, no later than Thursday, February 5, 2004.")

Call rtitem.AddNewLine(2)

Call rtitem.AppendText("Thank you for your interest in joining the Housing & Residence Life Team.")     

Call rtitem.AddNewLine(3)

Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", DataDir + TheFileName)

doc.Subject = "Circle Of Commitment & Interview Sign-up"

doc.SendTo = session.UserName

Call doc.Send(False)



 'This removes the file from their hard drive

Kill DataDir + TheFileName

End Sub

Subject: RE: Send a Form as an Email - code to email attachment

Hi Jason, I would like to use your code to be able to email any kind of attachment from Lotus Notes R6.5.3, not just MS Word DOCs. Can you asist me in modifying the code to b able todo that? Mike