[VBA] Send e-mail from shared account

Posted on 2003-03-17
Medium Priority
Last Modified: 2013-12-18
I'm writing an Access application, which generates Word documents with an average of 10 concurrent users. This attachments should be mailed using Lotus Notes from a shared account, which I will call the Desk account from here.

My problem is that I cannot find the reason why the e-mail I send, is send on my name, instead of the name of the Desk account. I hope anyone here has experience with sending e-mail from a general (shared) account on the network and can provide me example-code.

Below is the code I use to create an e-mailitem on the server:

Public Function LotusNotesEmail(strTo As String, strCC As String, strSubject As String, strBody As String, Optional strAttachmentPath As String)

Dim objNotesSession As Object
Dim objNotesDatabase As Object
Dim objNotesNewMail As Object
Dim objRichTextItem As Object

'Create a Lotus Notes Session and open the user database
Set objNotesSession = CreateObject("Notes.NotesSession")
Set objNotesDatabase = objNotesSession.GetDatabase("Mailin\dskmrgbw.nsf", "")

'Check if Lotus Notes is open already
If objNotesDatabase.IsOpen = False Then
End If

'Create a new mail and set the properties
Set objNotesNewMail = objNotesDatabase.CreateDocument
With objNotesNewMail
    .Form = "Memo"
    .SendTo = strTo
    .CopyTo = strCC
    .Subject = strSubject
    .Body = strBody
    .SaveMessageOnSend = True
End With

'If there is an attachment specified, than attach it (embedded) in the new mail
If (strAttachmentPath = "" Or strAttachmentPath = vbNullString) = False Then
    Call objNotesNewMail.EmbedObject(1454, "", strAttachmentPath)
End If

'Send the new mail
objNotesNewMail.PostedDate = Now()
Call objNotesNewMail.Send(False)

'Clean up all objects
Set objNotesSession = Nothing
Set objNotesDatabase = Nothing
Set objNotesNewMail = Nothing
Set objRichTextItem = Nothing

End Function
Question by:Jochem
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 63

Accepted Solution

Zvonko earned 1000 total points
ID: 8151689
Your question is a common problem.
Notes prevent you changing the From item in a mail.
But it offers one additional item name Principal for adjusting the From field visible by recipient.

And you have to know that last saving designer is the owner of an agent and so all mails are sent on below his/her name.

For this field Principal you have to do it like this:
With objNotesNewMail
   .Form = "Memo"
   .Principal = strPricipal
   .SendTo = strTo
   .CopyTo = strCC
   .Subject = strSubject
   .Body = strBody
   .SaveMessageOnSend = True
End With

Where the string strPrincipal could be something like this:
   "Zvonko Paunosk@EE"


Good luck,


Author Comment

ID: 8152139
Tnx Zvonko, you really helped me!
It's strange that this property is not know in the API of both Lotus and Domino. Point are for you.

A mistake in the code above, causes that the sent message was stored in the local folder of the sender. This has to be set to the following:

'GetDatabase(Servername, MailDatabasename)
Set objNotesDatabase = objNotesSession.GetDatabase("", "Mailin\dskmrgbw.nsf")


LVL 63

Expert Comment

ID: 8155162
Thanks for the points :-)

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question