E-Mail API Not Working with Lotus Notes

G

Guest

I am using an API that I found out about in order to fire off an E-Mail from
within an ADP application, on top of a SQL Server. This works just fine on a
system with Outlook, but on users' systems who are using Lotus Notes, the
body text of the message being passed in truncated. The New Message box for
Lotus comes up just fine, and the distribution list and subject line populate
into the new message box just fine. But the body text, which in my example
is about 1000 bytes, gets cut off after only about 100 or characters.

Here is the code I am using:
blnSentEMail = modGeneral.blnOpenEMail(strEMails, strSubject, strBody)

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Long

Public Function blnOpenEMail(ByVal strEmailAddress As String, Optional ByVal
strSubject As String, Optional ByVal strBody As String) As Boolean
'== Purpose: sends an E-Mail message using the default E-Mail client
currently on the host PC
'== Author: John R. Dougherty
'== Created: 08-31-2006
'== Modified: 12-12-2006
'== Notes:
'== -----------------------------------------------------------------

Dim lngWindow As Long
Dim lngRet As Long
Dim strParams As String

strParams = strEmailAddress
If LCase$(Left$(strParams, 7)) <> "mailto:" Then
strParams = "mailto:" & strParams
End If

If strSubject <> "" Then
strParams = strParams & "?subject=" & strSubject
End If

If strBody <> "" Then
strParams = strParams & IIf(strSubject = "", "?", "&")
strParams = strParams & "body=" & Replace$(strBody, gstrLINESEPCHAR,
"%0D%0A")
End If

lngRet = ShellExecute(0, vbNullString, strParams, vbNullString,
vbNullString, vbNormalFocus)


Any ideas on why this is happening?

- Thanks,

JRD
 
S

Sylvain Lafontaine

If it doesn't work only with Lotus Note, then you should ask in a newsgroup
about Lotus Note.

Another possibility would be to replace your code with a call to MAPI
(something that I won't have the idea of doing myself) or to use a SMTP
client instead (the most often used solution to send an email by code).

A free SMTP client is JMail:

http://www.dimac.net/default2.asp?M=Products/MenuCOM.asp&P=Products/w3JMail/start.htm

With the free version, you must have access to a SMTP server (most people
have) but I think that the Pro version have it. Also, IIS have its own SMTP
server, if I remember correctly.

On the Internet, you will also find a lot of other ActiveX and .NET controls
for STMP and POP3. IMHO, using them is a much better solution than trying
to do a shell command with mailto: .
 
S

Sylvain Lafontaine

Another possibility would be to use the SendObject function, see for
exemple:
http://support.microsoft.com/kb/555020

However, I never tried to use it with ADP.

If you don't want to create an installation process, then the only other
solution beside SendObject or mailto: would be to use extended MAPI. See
for example:

http://groups.google.ca/group/micro...736ec4?lnk=gst&q=mapi&rnum=8#5d8569a8b8736ec4

or maybe:
http://groups.google.ca/group/comp....56e468?lnk=gst&q=mapi&rnum=2#a82bfab4cf56e468


If you search the web, you might find many references related to Outlook and
MAPI, for exemple:
http://groups.google.ca/group/micro...8a5c33?lnk=gst&q=mapi&rnum=1#d5e1116f278a5c33

However, the latest is simply a part of the Outlook object model and has no
direct relation to extended MAPI.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top