Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
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


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Internet Technologies > HTML and CSS (15 articles)
   Using a reusable code approach to HTML select option lists
   One reader's opinion on HTML mailing
   Keep lookin' good with Cascading Style Sheets
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- 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.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login