views:

1881

answers:

7

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.

+3  A: 

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.

Joseph
+3  A: 

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.

blntechie
+3  A: 

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

Anders Lindahl
what are the arguments of maildb.Open?
Geo
Server and database file, but they are not necessary to know: The call to maildb.openmail connects it to the current users personal mail database.
Anders Lindahl
I'll try the script tomorrow at work and let you if it works.
Geo
Thanks Anders! Based on your script, I was able to write a ruby script that works !
Geo
This answer's so good, I'm always coming back to read it . Thanks!
Geo
+1  A: 

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.

http://glob.com.au/sendmail/

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.

Jeff.Crossett
the lotus notes client will be installed everywhere.
Geo
That makes it easier, but I forgot to also mention that the a user will need to be logged in, or the code will need to know which user ID to use and the password. This may have changed in more recent notes version.
Jeff.Crossett
+1  A: 

Hello,

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

A: 

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

akendrick451
+1  A: 

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.

Alexey Zimarev
Geo