Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lotus Notes email - Ughhhh

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
0
0
GB
Everything was fine until my user asked if text documents generated from the application could be emailed - using Lotus Notes. I have no knowledge of Lotus, never given it any priority, so now its produced a headache. Any ideas. Have done a search on the site but nothing basic enough. Thanks
 
If you are talking about mail-enabling your application, you are talking about MAPI or you can use the "Domino Mail Collaberation" object. I warn you , however, that mail enabling Notes CAN be rather tricky depending upon your setup.

The best thing I can suggest is to logon to the Lotus Notes site and do some surfing there. You should find examples of what you want there. Try:

P.S. I have an example of a DCO program which does mailing. If you let me have your email address I can send you the source. It should give you a starting point.

Good luck!
 
P.P.S. Sorry forgot - If you have loaded the MSDN onto your machine, have a look in the samples directory. You will find a VBMail project which shows that use of MAPI.
 
Many thanks, I will look at their site. I just loaded Lotus 97 Smartsuite and it' wrecked my application. I took a gamble on Win95 application working on Win98 but maybe that was a risk too many. Thanks again
 
If notes is installed on the dev machine, use the Lotus Notes Automation Classes reference and this code:

Private Sub SendMail()
Dim sAttach As String
Dim sBody As String
Dim sSubject As String
Dim sRecip As String
Dim sRecip02 As String

sAttach = 'your attachment path
sBody = 'body of email
sSubject = 'subject line
sRecip = "someone@somewhere.com"
sRecip02 = "someone@somewhereelse.com"

SendNotesMail sSubject, sAttach, sRecip, sRecip02, sBody, False



Public Sub SendNotesMail(Subject As String, Attachment As String, _
Recipient01, Recipient02, BodyText As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.GETDATABASE("", MailDbName)
If Maildb.ISOPEN = True Then
'Already open for mail
Else
Maildb.OPENMAIL
End If
'Set up the new mail document
Set MailDoc = Maildb.CREATEDOCUMENT
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient01
MailDoc.sendto = Recipient02
MailDoc.Subject = Subject
MailDoc.Body = BodyText
MailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
If Attachment <> &quot;&quot; Then
Set AttachME = MailDoc.CREATERICHTEXTITEM(&quot;Attachment&quot;)
Set EmbedObj = AttachME.EMBEDOBJECT(1454, &quot;&quot;, Attachment, &quot;Attachment&quot;)
' MailDoc.CREATERICHTEXTITEM (&quot;Attachment&quot;)
End If
'Send the document
MailDoc.SEND 0, Recipient01
MailDoc.SEND 0, Recipient02
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub
 
I'm told that MAPI doesn't work well with Notes. My customer wants emails added to the programme, which I can do this (hopefully), but I can't find out what reference to add to get the Notes.NotesSession bit. I definately don't want to buy Notes and really really don't want to install it on my dev pc just to get this bit working. I have a copy of Notes 5 beta on a spare pc but still couldn't find the reference.

Anybody know?

I even rand IBM and they helpfully gave me the number of a Notes help office who only do paid support. Not good.
Peter Meachem
peter @ accuflight.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top