FoxPro/Visual FoxPro - Lotus Notes

 
Vista:

Lotus Notes

Publicado por Alejandro (2 intervenciones) el 06/05/2005 20:57:07
Hola, necesito ayuda en como mandar email desde vfox con Lotus Notes
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Lotus Notes

Publicado por Hector Ramirez (1 intervención) el 05/11/2007 19:13:45
*------------------------------------------------------------
* SendEmail
*
* Sends Emails via Lotus Notes
*
* Parameters
* laSendTo array of character strings ("John Smith","[email protected]",...)
* laCC same as laSendTo
* laBCC same as laSendTo
* lcSubject character string ("Test Mail")
* lcBody character string ("Body of Test Mail")
* laAttachments array of character strings ("c:\printrep.xls","c:\preintrep2.xls",...)
*------------------------------------------------------------
PROCEDURE SendEmail
LPARAMETERS laSendTo, laCC, laBcc, lcSubject, lcBody, laAttachments
EXTERNAL ARRAY laSendTo, laCC, laBcc, laAttachments

LOCAL loSession && the note session to be oppened
LOCAL lcServer && notes server
LOCAL lcMaildbName && Mail db Name
LOCAL loMaildb && Mail db object
LOCAL loMailDoc && Document object, the email itself
LOCAL loStream && text stream used to attach a MIME document to the email object
&& i.e the Body of the object.

loSession = CREATEOBJECT( "Lotus.NotesSession" )
loSession.Initialize( )
* this will ask you for a password. A dialog will pop up for you to type it in
* or you can supply it programaticaly...
* loSession.Initialize( 'PASSWORD' )
* or use an email account without a password and you won't need to worry about it

* Get the default server and maildb for this PC from the Note Session
*lcServer = "dwim01/domgen"
*lcMaildbName = "mail\jsmith.nsf"
lcServer = loSession.GetEnvironmentString( "MailServer",.t.)
lcMaildbName = loSession.GetEnvironmentString( "MailFile",.t.)

* open the notes mail database
loMaildb = loSession.getdatabase(lcServer, lcMaildbName )
* create a document/email for the mail database
loMaildoc = loMaildb.CreateDocument()

* Who do we send it to
loMaildoc.ReplaceItemValue( "Form", "Memo" )
IF !EMPTY( laSendTo )
loMaildoc.ReplaceItemValue( "SendTo", @laSendTo )
ENDIF
IF !EMPTY( laCC )
loMaildoc.ReplaceItemValue( "CopyTo", @laCC )
ENDIF
IF !EMPTY( laBcc )
loMaildoc.ReplaceItemValue( "BlindCopyTo", @laBcc )
ENDIF

* The subject
loMaildoc.replaceitemValue( "Subject", lcSubject )

* The Body
loStream = loSession.CreateStream()
loStream.WriteText( lcBody )
* The Body MIME type
loBodyMime = loMailDoc.CreateMIMEEntity()
loBodyMime.SetContentFromText( loStream, "text/html;charset=iso-8859-1", .f. )

* Attachments
IF !EMPTY( laAttachments )
loRichTextItem = loMailDoc.CreateRichTextItem("Attachment")
FOR e = 1 TO ALEN( laAttachments )
loRichTextItem.EmbedObject(1454, "", laAttachments[e] )
NEXT
ENDIF

* this bit just me playing with the paper type and icons displaid in Notes.
* If its a propery in Notes then you can change it like this....
*(i.e. right click on the message, Document Proterties, 2nd tab...then experiment)
loMaildoc.ReplaceItemValue( "Logo", "StdNotesLtr3" )
loMaildoc.ReplaceItemValue( "_ViewIcon", 23 )
loMaildoc.ReplaceItemValue( "SenderTag", "Y" )

* Finaly send the email
loMaildoc.send( .F. )

RETURN
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar