Tutorial :Can I use Lotus Notes to send mail?


I have to code an app that at some point in time will have to send some reports using Lotus Notes.

My questions are :

  1. Can I send mail through the Lotus Notes client, or something related to Lotus Notes ( a command line tool maybe? )? If so, where could I find information related to this? I would prefer not having to do it in C/C++, but if no other options' present, that would do.

  2. How can I find out the server's address? The GUI is not intuitive, and I can't find the server address. The server's located on another computer on the network.


Here's an example of half-a-decade old code to send a Notes mail from Excel VBA using the Notes OLE objects - guess they can be used in most of your preferred platforms:

Dim session As Object  Dim maildb As Object  Dim maildoc As Object  Dim body As Object    Public Sub send(subject, recipient, filename)      On Error GoTo errorhandler      Const EMBED_ATTACHMENT = 1454      Call maildb.OpenMail        If Not maildb.IsOpen Then Call maildb.Open("", "")        Set maildoc = maildb.createdocument      Set body = maildoc.createrichtextitem("body")        Call maildoc.replaceitemvalue("form", "memo")      Call maildoc.replaceitemvalue("subject", subject)        Call body.EmbedObject(EMBED_ATTACHMENT, "", filename, subject)      Call maildoc.send(false,recipient)  End Sub    Private Sub Class_Initialize()      Set session = CreateObject("Notes.NotesSession")      Set maildb = session.getDatabase("", "")  End Sub  

The documentation for the various Notes objects can be found here: Lotus Domino Designer documentation


Yes you can send email through a Lotus Notes client. I've had to do this before in a .NET application because a number of our clients were using Lotus Notes.

Lotus Notes publishes an SDK to do this.

Here's a link.

We used Interop to get the thing working. Also, be sure that you pick the correct version of the SDK. It has to match up with the version of Lotus Notes your client uses. If you use the wrong one then it won't work on their machines.


I have no idea about Lotus Notes. But for sending email from code i'm not sure why you need a client. In case of Exchange, you just need the server details(or any SMTP server) and then code it in the language you need. You need to go where the Lotus notes client is configured for mail accounts for finding out server details.


try https://rubygems.org/gems/notes_mailer (disclaimer: i'm the author)



Here is a command line tool for sending SMTP messages. Just place the SMTP server's IP address in the config file and use command line statements to build an output file that is used for sending.

Remember: if you write code that actually uses the Notes client, the client will need to be installed everywhere this code runs.


As for the SMTP server address, I would suggest contacting anyone in your organization that deals with messaging. Sometimes companies have a separate internal SMTP server set aside for just this purpose. Otherwise, you will need to look into the Configuration \ Servers \ All Server Documents section of the Notes Directory to find the SMTP servers address.


Need more specifics on the mail options but the easiest are as follows:

1) Use an @Function - Example @MailSend This is a built in function in notes that can be used on a form. Like when you press a button or save a document. You can open the lotus notes designer and look at help for all the info.

2) You can use lotus script to create your own custom email send.

Here is a link to the notes forum that will have the answer u seek. http://www-10.lotus.com/ldd/46dom.nsf?OpenDatabase


There's the Domino .NET assembly from Notes version 6.5 and above which provides you with fairly easy ways to use Lotus Notes object model in your .NET application (so you can write C# code), however some general knowledge is needed about the object model itself and how to program Notes classes. However you can find many answers on the DeveloperWorks of IBM for Lotus (http://www.notes.net).

You can also put your data to the HDD and create LotuScript local agent to pick it up and send over via email. For this you need some LotusScript knowledge. Local agents can be scheduled easily but Notes client needs to run on that machine all the time.

Server address is not needed when you send emails from Notes code (either .NET app or LotusScript code). All addresses are configured in Notes configuration documents called Locations and Connections. These documents are to be found in the local Address Book application, in the Advanced section. You can also manage locations via the File menu (starting from version 8 I assume). It's rather simple but not "Microsoft style" and that's why you call it "not intuitive".

But normally Notes client is not used to send automated mails unless it's done during the user interaction with Notes application itself. If you need to send mails over you can integrate with the Domino server and send mails from there using scheduled agents. But in case you use .NET code it could also use the client API to do this but you'll need to have Notes client installed on the machine where you run your application that sends mail.

The final option would be to send it over SMTP. This will require SMTP relaying configuration on the server and will not support encryption that is provided "out of the box" by Lotus Notes/Domino.


To answer question 2. You can get the name of the server, which is the lotus notes name by the following:

Private Sub Class_Initialize()        Set session = CreateObject("Notes.NotesSession")      dim strServerName as string      strServerName = session.CurrentDatabase.Server      If ( strServerName  = "" ) Then          Messagebox( "This database is local." )      Else         Messagebox( "This database is on a server named "+ strServerName +"." )      End If    End Sub  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »