project BLF > class Mail > method SendWithAttachments
Description
Send a mail with a certain number of files attached to it
Parameters
icFrom | input | character | From addressee |
icTo | input | character | Pipe (|) separated list of recepients addresses. |
icCc | input | character | Pipe (|) separated list of recepients carbon copy addresses. |
icSubject | input | character | Subject of the mail |
icBody | input | character | Body text of the mail. |
icAttachments | input | character | comma separated list of files that need to be attached to the mail message. The files need to be reachable through the propath of the session, or they need to be qualified with the full path. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/mail.p)
assign oiReturnStatus = -98.
assign vcCc = icCc
vcDate = ENTRY(WEEKDAY(today),"Sun,Mon,Tue,Wed,Thu,Fri,Sat":U) + " ":U +
STRING(DAY(today)) + " ":U +
ENTRY(MONTH(today),"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec":U) + " ":U +
STRING(YEAR(today)) + " ":U +
STRING(time,"HH:MM:SS":U) + " ":U +
string(timezone(now) * 5 / 3,"+9999").
/* Check the attachments */
ASSIGN vcAttachments = "".
DO viCnt = 1 TO NUM-ENTRIES(icAttachments) :
ASSIGN vcAttachments = vcAttachments +
(IF vcAttachments = "" THEN "" ELSE ",":U) +
SEARCH(ENTRY(viCnt,icAttachments)).
END.
IF vcAttachments = ?
THEN DO :
ASSIGN oiReturnStatus = -98.
RETURN.
END.
<M-1 run Send
(input icFrom (icFrom),
input icTo (icTo),
input icSubject (icSubject),
input icBody (icBody),
output oiReturnStatus (oiReturnStatus)) in Mail>
if oiReturnStatus <> 0 then return.
assign oiReturnStatus = 0.