General information
Category:
Coding, syntax & commands
Title:
Produce email minimized
I am using craig boyd's email code below for outlook and am producing multiple emails during a processing.
I would like to display these as opposed to sending them right away into OUTBOX - but i would like them to accumulate on the bottom of the screen minimized.
Is there a code i can use to 'open' these generated emails into minimized windows.?
(i want the processes to continue without dealing with the emails until the end of the processing.)
thanks
k
*******************************
*!* Example of using SendViaOutlook
*******************************
#DEFINE olImportanceLow 0
#DEFINE olImportanceNormal 1
#DEFINE olImportanceHigh 2
DIMENSION aryAttach(1)
aryAttach(1) = ematt && change to an actual file that exists on your computer
*aryAttach(2) = "c:\db\prg\menu\m.txt" && change to an actual file that exists on your computer
LOCAL lcTo, lcSubject, lcBody, lcCC, lcBCC, llHTMLFormat, llOpenEmail, lcErrReturn
lcto = someone@hotmail.com
lcSubject = "NEED TO MINIMIZE MESSAGE"
*!* Sending the body in HTML format
llHTMLFormat = .F.
lcBody = 'SAMPLE.TXT'
lcCC = " "
lcBCC = " "
*!* to automatically send email set llOpenEmail to .F.
llOpenEmail = .T. && Whether email is opened in Outlook or not
SendViaOutlook(@lcErrReturn, lcTo, lcSubject, lcBody, @aryAttach, lcCC, lcBCC, llHTMLFormat, olImportanceHigh, llOpenEmail)
IF EMPTY(lcErrReturn)
* MESSAGEBOX("'" + lcSubject + "'" + IIF(llOpenEmail, " Prepared ", " sent ") + "successfully.", 64,"Send email via MS Outlook")
ELSE
MESSAGEBOX("'" + lcSubject + "' failed to be sent. Reason:" + CHR(13) + lcErrReturn, 64, "Send email via Outlook")
ENDIF
*******************************************
PROCEDURE SendViaOutlook(tcReturn, tcTo, tcSubject, tcBody, taFiles, tcCC, tcBCC, tlHTMLFormat, tnImportance, tlOpenEmail)
*******************************************
LOCAL loOutlook, loItem, lnCountAttachments, loMapi
TRY
loOutlook = CREATEOBJECT("outlook.application")
loMapi = loOutLook.GetNameSpace("MAPI")
loMapi.Logon()
loItem = loOutlook.CreateItem(0)
WITH loItem
.Subject = tcSubject
.TO = tcTo
IF tlHTMLFormat
.HTMLBody = tcBody
ELSE
.Body = tcBody
ENDIF
IF TYPE("tcCC") = "C"
.CC = tcCC
ENDIF
IF TYPE("tcBCC") = "C"
.BCC = tcBCC
ENDIF
IF TYPE("tnImportance") != "N"
tnImportance = 1 && normal importance
ENDIF
.Importance = tnImportance
IF TYPE("tafiles",1) = "A"
FOR lnCountAttachments = 1 TO ALEN(taFiles)
.Attachments.ADD(taFiles(lnCountAttachments))
ENDFOR
ENDIF
IF tlOpenEmail
.display()
ELSE
.SEND()
ENDIF
ENDWITH
CATCH TO loError
tcReturn = [Error: ] + STR(loError.ERRORNO) + CHR(13) + ;
[LineNo: ] + STR(loError.LINENO) + CHR(13) + ;
[Message: ] + loError.MESSAGE + CHR(13) + ;
[Procedure: ] + loError.PROCEDURE + CHR(13) + ;
[Details: ] + loError.DETAILS + CHR(13) + ;
[StackLevel: ] + STR(loError.STACKLEVEL) + CHR(13) + ;
[LineContents: ] + loError.LINECONTENTS
FINALLY
RELEASE oOutlook, oItem
STORE .NULL. TO oOutlook, oItem
ENDTRY
ENDPROC
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only