Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154

    Unhappy Unanswered: Sending email to Lotus Notes help! (NICE LONG Q!)

    Hi all,

    I'm about to display to you all what a HACK I truly am! (Just don't tell my client!) If I am beyond hope, maybe just recommend a book!

    I've been reading over the past couple of hours on how to send a form to be emailed from Access to Lotus Notes, trying to figure out exactly how to do it. While I came across plenty o' code, I cannot determine how to implement it...

    I have discovered Public functions that are available to send a mail object, at the bottom of this email, I have included one as passed on by Ottomatic last September in thread...

    Where do I put the code? Does it go into a class module?

    How do I call them? Can I reference it during an onclick event?

    If I include this code for a FORM button, will I have to extensively modify the code for the message body to include all desired fields and create a clean layout in the email? I've seen some examples of that. I guess I'm asking is there a way to just plop form data into the email without extensive customization... (lazy!)

    Muchos thanks and any help would be greatly appreciated!

    Following is the code I'm trying to work with, stolen from another post on this site!
    ---------------------------------------

    Function MailLotusApp(Recipient As String, Subject As String, BodyText As String)
    'This function sends the mail

    'Setup the objects required for Automation into Lotus notes
    Dim Maildb As Object ' The mail database
    Dim UserName As String 'The users notes name
    Dim MailDbName As String ' The users notes mail database name
    Dim MailDoc As Object ' The mail doc itself
    Dim Session As Object ' The notes session


    'Start notes session
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    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 doc
    If (Not (Recipient = "")) Then
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.sendto = Recipient
    MailDoc.Subject = Subject
    MailDoc.Body = BodyText
    'Send the mail
    MailDoc.SEND 0, Recipient
    End If

    'Clean up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Session = Nothing

    End Function

  2. #2
    Join Date
    Mar 2004
    Posts
    10

    Question Re: Sending email to Lotus Notes help! (NICE LONG Q!)

    Ok well, if i understand you want to send en email from ms access via lotus notes or perhaps to lotus notes which one is it that you are looking for?

    is lotus notes installed on the pc that you are sending from?

    well if not , i think you should install it, i have looked at the code and it works! acually your question helped me out, cause i have been looking for sample code and well thats why you helped me.


    It should work without a problem provided you have lotus notes installed on the pc here is.

    here is straight forward code which will execute on the onclick even of a button.

    Say my username is "azax net" the database it would use is "anet.nsf"
    If you have lotus notes open then all will be good and if lotus notes is close at the time it will open a session of lotus notes.
    Well, if you have lotus notes installed on your pc you should be fine, even if you leave "azaxnet.nsf" as "" it should pick up the default user and Db.

    Good luck


    'This function sends the mail

    'Setup the objects required for Automation into Lotus notes
    Dim Recipient As String = "azaxnet@hotmail.com"

    Dim Maildb As Object ' The mail database
    Dim UserName As String 'The users notes name
    Dim MailDbName As String ' The users notes mail database name
    Dim MailDoc As Object ' The mail doc itself
    Dim Session As Object ' The notes session


    'Start notes session
    Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    UserName = Session.UserName
    MailDbName = "anet.nsf"
    'Open the mail database in notes
    Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.ISOPEN = True Then
    'Already open for mail
    Else
    Maildb.OPENMAIL()
    End If

    'Set up the new mail doc
    If (Not (Recipient = "")) Then
    MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.sendto = Recipient
    MailDoc.Subject = "This is the subject"
    MailDoc.Body = "This is the body text"
    'Send the mail
    MailDoc.SEND(0, Recipient)
    End If

    'Clean up
    Maildb = Nothing
    MailDoc = Nothing
    Session = Nothing

























    Originally posted by jimmyswinger
    Hi all,

    I'm about to display to you all what a HACK I truly am! (Just don't tell my client!) If I am beyond hope, maybe just recommend a book!

    I've been reading over the past couple of hours on how to send a form to be emailed from Access to Lotus Notes, trying to figure out exactly how to do it. While I came across plenty o' code, I cannot determine how to implement it...

    I have discovered Public functions that are available to send a mail object, at the bottom of this email, I have included one as passed on by Ottomatic last September in thread...

    Where do I put the code? Does it go into a class module?

    How do I call them? Can I reference it during an onclick event?

    If I include this code for a FORM button, will I have to extensively modify the code for the message body to include all desired fields and create a clean layout in the email? I've seen some examples of that. I guess I'm asking is there a way to just plop form data into the email without extensive customization... (lazy!)

    Muchos thanks and any help would be greatly appreciated!

    Following is the code I'm trying to work with, stolen from another post on this site!
    ---------------------------------------

    Function MailLotusApp(Recipient As String, Subject As String, BodyText As String)
    'This function sends the mail

    'Setup the objects required for Automation into Lotus notes
    Dim Maildb As Object ' The mail database
    Dim UserName As String 'The users notes name
    Dim MailDbName As String ' The users notes mail database name
    Dim MailDoc As Object ' The mail doc itself
    Dim Session As Object ' The notes session


    'Start notes session
    Set Session = CreateObject("Notes.NotesSession")
    'Get the sessions username and then calculate the mail file name
    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 doc
    If (Not (Recipient = "")) Then
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    MailDoc.sendto = Recipient
    MailDoc.Subject = Subject
    MailDoc.Body = BodyText
    'Send the mail
    MailDoc.SEND 0, Recipient
    End If

    'Clean up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Session = Nothing

    End Function

  3. #3
    Join Date
    Feb 2004
    Posts
    25
    This is awesome. Don't mess with the code just call it from an event:

    Call MailLotusApp("whoever@domain.com", "Email Subject", "The body of email text")


    Two questions.
    1) Can you do attachments & how (syntax)?
    2) Can you get these to show up in your sent box? As it runs it is blind...

  4. #4
    Join Date
    Mar 2004
    Posts
    10
    Thats a good question, i did have a look but it seems as if its not that simple to add an attachment.
    IT looks like you have to create a notesembededobject , being the attachment object , and then somehow it has to be link to the document.

    Well if you fin an answer it would be good to know....

    Regards,



    Originally posted by glnstanley
    This is awesome. Don't mess with the code just call it from an event:

    Call MailLotusApp("whoever@domain.com", "Email Subject", "The body of email text")


    Two questions.
    1) Can you do attachments & how (syntax)?
    2) Can you get these to show up in your sent box? As it runs it is blind...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •