Hi!I would like to have a ‘Welcome email’ in each of my mail templates so that when I create a new user’s mailbox, the email is there. How do you make a document a part of a template design?
Subject: NotesDocument in Template Design… Stan Rogers
Thanks for your response… I will give it a try. But I wonder why this solution doesn’t work for me…
The issue is the same.
Subject: RE: NotesDocument in Template Design… Stan Rogers
Probably because mail databases are created by the user registration process; and that is not the same as creating a database manually from a template. The code in the user registration process apparently does not copy data notes from the template to the new mailbox.
Subject: RE: NotesDocument in Template Design… Stan Rogers
Still, this is a nice idea, I think. Many mail providers do this, and even Outlook Express (if I remember right, as I never use it).
Maybe this could even make to ideajam.net
Subject: Another way to look at it
What I’ve done is to create an agent that runs in one of my administrative databases that searches the Domino Directory for new users and then sends an HTML email to them. It’s rudimentary, and the code I use for the HTML mail is stuff I got from somewhere on the 'net, but it works. It also allows me to change the text easily instead of having to re-work the template. You could easily expand it to use a form to store the text, etc. if you wanted.
I’ve left the mail text in as a sample of what you can do with it. Just be sure to change any and all server and database references in URLs and the script.
'New Notes user email:
Option Public
Option Declare
Use “OpenLogFunctions”
Sub Initialize
'Declare Variables
Dim s As New NotesSession
Dim user As NotesName
Dim fname As notesitem
Dim inetadd As notesitem
Dim nabdb As NotesDatabase
Dim viewpeople As NotesView
Dim docperson As NotesDocument
Dim datetime As New NotesDateTime("01/01/2007")
Dim coll As NotesDocumentCollection
Dim selection As String
Dim firstname As String
Dim inetaddress As String
On Error Goto gotError
Set nabdb = s.GetDatabase("DomServer", "names.nsf")
selection = { (MailSystem = "1") & (@Created = @Today) & (@IsUnAvailable($Conflict)) }
Set coll = nabdb.Search( selection , datetime , 0)
Set docperson = coll.GetFirstDocument
While (Not docperson Is Nothing)
Set user = New NotesName(docPerson.FullName(0))
Set fname = docPerson.GetFirstItem("FirstName")
firstname = fname.Text
Set inetadd = docPerson.GetFirstItem("InternetAddress")
inetaddress = inetadd.Text
Print user.Abbreviated
Call Newsletter(user, firstname, inetaddress)
Set docperson = coll.GetNextDocument(docPerson)
Wend
Exit Sub
gotError:
Call LogError
Exit Sub
End Sub
Sub Newsletter(user As NotesName, firstname As String, inetaddress As String)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Dim host As String
Dim view As NotesView
Dim doc As NotesDocument
Dim sTemp As String
On Error Goto gotError
Set db = s.CurrentDatabase
'Capture the server name and filepath for use in URLs
Dim ServerName As New NotesName( db.Server )
host = "http://" + ServerName.Common & ".domain.com"
s.ConvertMIME = False ' Do not convert MIME to rich text
Set stream = s.CreateStream
Set view = db.GetView("newusertips")
Set doc = view.GetFirstDocument()
'Begin creating the message doc to send
Dim message As New NotesDocument (db)
message.Form="memo"
Set body = message.CreateMIMEEntity
'Basic profile of email
message.Subject = "Welcome to Lotus Notes"
message.SendTo = user.Abbreviated
message.RecNoOutOfOffice = "1" 'Set it so out of office agents don't reply to the message
message.ExpandPersonalGroups = "0" 'Set message to not expand groups
’ Open the HTML (Title doesn’t matter since it doesn’t appear anywhere)
Call stream.WriteText ("<html><head><title>Notes Tips Recap</title>")
’ BEGIN: Inline Stylesheet
Call stream.WriteText (|
|)
’ END: Inline Stylesheet
Call stream.WriteText ({</head>})
Call stream.WriteText ({<body text="#666666" bgcolor="#FFFFFF"
leftmargin=“0” topmargin=“0” marginheight=“0” marginwidth=“0”>})
’ BEGIN: HTML body
Call stream.WriteText ({
<table width="100%" border="0" cellspacing="0" cellpadding="0"
bgcolor=“#FFFFFF”>
<tr>
} + Cstr(firstname) + {,
Welcome to Lotus Notes, YourCo's e-mail, calendaring, and collaboration platform. Below you will find a sampling of tips for Lotus Notes and/or Domino Web Access. Click each link to open and read the tip.
You will want to review the tip on changing your password, if you haven't already been walked through the password change process. Next, you'll want to create your signature block for your email.
Feel free to look through all the tips as you have time, or use the built-in help feature in Notes by hitting the F1 key for help related to the task you’re performing. As new tips are added, you’ll get email notification, along with a monthly recap of all tips that are available.
For outside contacts, your email address is: } + Cstr(Inetaddress) + {
A sample of Notes Tips you may find helpful now:
})
Do Until doc Is Nothing
'You will have to hardcode the server_name and databasePath in a scheduled agent because there is no
'fixed method for getting these variables. They could come from the server document, but everyone has a
'different set up.
sTemp=sTemp+|<li><a title="Newsletter link" href="notes://domserver.domain.com/tips/notestips.nsf|
sTemp=sTemp+{/All/}+doc.UniversalID+Cstr(doc.Subject(0))+{</a></li>}
Call stream.WriteText ({<li><a title="Newsletter link" href="notes://domserver.domain.com/tips/notestips.nsf/All/}+doc.UniversalID+{?OpenDocument&login">}+Cstr(doc.Subject(0))+{</a> - Published: } + Cstr(doc.Created) + {</li>})
Set doc=view.getnextdocument(doc)
Loop
Call stream.WriteText({</td></tr><tr><td><br>Here's a link to the Notes Signature Wizard to create or update your mail signature:
})
Call stream.WriteText ({
Visit the Notes Tips database for more
tips. If you are using a browser, please go to <a title="Notes Tips" href="http://dwaserver.domain.com/tips/notestips.nsf">http://dwa.domain.com/tips/notestips.nsf</a> to view the tips.<br>
If you need assistance with Notes, please call the Helpdesk at 888-555-1234.
</tr>
})
’ END: HTML body
’ Close the HTML
Call stream.WriteText ({</body></html>})
’ Ensure the MIME content will be recognized as HTML (Must be after the stream is written)
Call body.SetContentFromText (stream, "text/html;charset=iso-8859-1", ENC_NONE)
'Send the email
Call message.Send (False)
s.ConvertMIME = True ' Restore conversion
Exit Sub
gotError:
Call LogError
Exit Sub
End Sub
Subject: RE: Another way to look at it
Thanks Ted. I’m gonna give your agent a try.
Subject: NotesDocument in Template Design
I don’t know that you can. What you could do is have code run in the Database script on PostOpen that creates a document and sticks it in the Inbox, then sets an environment variable. Wrap the code in an If statement that checks for the value of the environment variable to ensure that it only runs the first time the database is opened.