Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lotus Notes & Email
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00322110
Message ID:
00323244
Views:
32
Daniel,

The following procedure may help you.
Hope this helps,


PROCEDURE SendMessage
LPARAMETER tcRecipient, tcSubject, tcMessage, tcAttachment

*-- check parameters ------------------------------------------------------------------------------
IF TYPE("tcRecipient") <> "C" OR EMPTY(tcRecipient)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 1 : Parameter missing or wrong type. Procedure canceled!"
RETURN -1
ENDIF
IF TYPE("tcSubject") <> "C" OR EMPTY(tcSubject)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 2 : Parameter missing or wrong type. Procedure canceled!"
RETURN -2
ENDIF
IF TYPE("tcMessage") <> "C" OR EMPTY(tcMessage)
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 3 : Parameter missing or wrong type. Procedure canceled!"
RETURN -3
ENDIF
IF PCOUNT() = 4 AND (TYPE("tcAttachment") <> "C" OR NOT FILE(tcAttachment))
??CHR(7)
WAIT WINDOW NOWAIT "Parameter 4 : File not found. Procedure canceled!"
RETURN -4
ENDIF
*--------------------------------------------------------------------------------------------------

LOCAL loNotes, loDb, loDoc, lcMsg, loRichTextItem

loNotes = CreateObject("Notes.Notessession") && create notes session
loDb = loNotes.GetDatabase("", "") && set db to database not yet named
loDb.openmail && set database to default mail database

loDoc = loDb.CreateDocument && create a mail document

loDoc.ReplaceItemValue("SendTo", tcRecipient) && Recipient
loDoc.ReplaceItemValue("Subject", tcSubject) && Subject
loDoc.ReplaceItemValue("Body", tcMessage) && Message Body

*-- check if there's an attachment
IF NOT EMPTY(tcAttachment)
loRichTextItem = loDoc.CreateRichTextItem("Attachment") &&
=loRichTextItem.EmbedObject(1454, "", tcAttachment) && attach a file
ENDIF

*loDoc.Save(.T., .T.) && save message
loDoc.Send(.F.) && send message

RELEASE loNotes
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform