Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 4th, 2005, 07:14 AM
Registered User
 
Join Date: Feb 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending email using Lotus Notes

Hi,

I want help on the Excel VBA to send email using Lotus Notes. Can anybody provide me with the related code.

Thanks!
 
Old February 7th, 2005, 12:31 AM
Registered User
 
Join Date: Feb 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got the answer. Here is the code for reference:

Public Sub SendNotesMail(Subject As String, attachment As String, recipient As String, 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 = recipient
    MailDoc.Subject = Subject
    MailDoc.Body = bodytext
    MailDoc.SAVEMESSAGEONSEND = saveit
    'Set up the embedded object and attachment and attach it
    If attachment <> "" Then
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", attachment, "Attachment")
        MailDoc.CREATERICHTEXTITEM ("Attachment")
    End If
    'Send the document
    MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
    MailDoc.SEND 0, recipient
    'Clean Up
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing
End Sub
 
Old January 5th, 2006, 12:50 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Can you tell me if it is possible with the code to change the sender address, i have tried several things, but have not been able to chnage the sender address to the recipient.

regards

Marcel Bergmans

groetjes / regards

Marcel Bergmans
 
Old February 1st, 2006, 01:17 AM
Registered User
 
Join Date: Feb 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Was wondering what references you would need to get this to work using Lotus R5?

Thanks

Craig

Craig Lambie
Gigtxt.com
 
Old April 6th, 2006, 07:56 PM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried the code and other code posted on various web sites and it works fine from MSAccess97 except that when a user has a SIGNATURE created in their LoNo preferences the text I add is added to the end of their signature:(. How can I force MY text to appear in front of a users signature
Thanks
 
Old August 23rd, 2007, 07:10 AM
DVR DVR is offline
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Good article for sending mail with attachment via Lotus Notes using C#,

I need some more from you
I need to send multiple files as an attachment using the same code which is given in this article.

any help will be appreciated

thanks in advance

DVR






Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Via Lotus Notes poyserr Access 1 June 30th, 2009 04:05 PM
Issue with Lotus Notes Warbird VB How-To 1 November 13th, 2007 01:06 PM
Integrating Lotus notes with .net vivek_inos ASP.NET 2.0 Professional 2 June 12th, 2007 04:52 AM
HTML email format in Lotus Notes. mcinar Classic ASP Professional 2 June 5th, 2007 09:33 AM
Lotus Notes GuyB ASP.NET 1.0 and 1.1 Basics 0 December 27th, 2005 07:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.