|
|
|
|
|
|
|
|
|
|
|
|
|
|
Domino forms for all (continued)
FIGURE B
 
Here's a Mail In Database document. Roll over picture for a larger image.
This is simply any ordinary Notes database with a special address registered in the Public Name and Address Book (Domino Directory to R5 users). When any document is mailed to that mail-in address, it's saved into the associated database, just as if a user had manually created and saved the document there. Final processing can occur using an Incoming Mail Agent, which runs whenever new documents are mailed in.
Putting it all together Putting these two technologies together, we have a method that allows any Web form to email its submissions to a Notes database, which then processes them as if a customer had accessed Notes directly. Ironically, for all the Internet standards integration of Domino, the only reason why this technique won't run on an R3 server is the need to use LotusScript. Coding a mail-handling agent solely in formula language is a challenge I shall leave to other developers!
Here's a summary of the components required for this to function:
- HTML page with <FORM> tags;
- FormMail CGI script/program;
- Notes database;
- Mail-In Database document in Domino Directory/Public Name and Address Book;
- Agent with "After Mail Received" Trigger to process incoming mail.
The key to making this work is the Notes agent handling the incoming mail. This has to examine the body of each incoming mail and decode it, picking out the field names and values and saving them as items on a Notes document.
Here's a sample Incoming Form Mail Agent:
Sub Initialize
' declare domino objects
Dim sessThis As New NotesSession
Dim dbThis As NotesDatabase
Dim docMemo As NotesDocument
Dim dcMemos As NotesDocumentCollection
Dim rtBody As NotesItem
' declare lotusscript variables
Dim strLine As String, strBody As String
Dim intCurPos As Integer, intLFPos As Integer
Dim blnMoreText As Integer
Dim strFieldValue As String,strFieldName As String
' assign domino objects
Set dbThis=sessThis.CurrentDatabase
Set dcMemos=dbThis.AllDocuments
Set docMemo=dcMemos.GetFirstDocument
On Error Goto catchGeneralError
' main loop
While Not (docMemo Is Nothing)
' get body rich text item
Set rtBody=docMemo.GetFirstItem("Body")
strBody=rtBody.Text
' loop thru each line in mail body
intCurPos=1
blnMoreText=True
While blnMoreText
intLFPos=Instr(intCurPos,strBody,Chr$(10)) ' search for end of line
If intLFPos=0 Then
blnMoreText=False
strLine=Mid(strBody,intCurPos,Len(strBody)-intCurPos+1)
Else
strLine=Mid(strBody,intCurPos,intLFPos-intCurPos)
intCurPos=intLFPos+1
End If
' search for = sign to indicate start of assignment
If Instr(strLine,"=")>0 Then
' save last web form field to Notes document
If strFieldName<>"" Then
Call docMemo.ReplaceItemValue(strFieldName,strFieldValue)
End If
' get name and value of this field
strFieldValue=Right(strLine,Len(strLine)-Instr(strLine,"="))
strFieldName=Left(strLine,Instr(strLine,"=")-1)
Else
' add text onto a multi-line field
strFieldValue=strFieldValue+Chr$(10)+strLine
End If
Wend
' save last discovered web form field to Notes document
If strFieldName<>"" Then
Call docMemo.ReplaceItemValue(strFieldName,strFieldValue)
End If
Call docMemo.Save(True,True)
' fetch next e-mail
Set docMemo=dcMemos.GetNextDocument(docMemo)
Wend
Exit Sub
catchGeneralError:
Print intCurPos,intLFPos,Error$,Erl
Exit Sub
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|