45 lines
1.7 KiB
Plaintext
45 lines
1.7 KiB
Plaintext
FUNCTION envia_correo()
|
|
DEFINE result, id INTEGER
|
|
DEFINE str,cuerpo_correo,subject STRING
|
|
|
|
LET cuerpo_correo = "ESTA ES LA PRIMERA LINEA DEL CUERPO DEL CORREO ^M"
|
|
LET cuerpo_correo = cuerpo_correo CLIPPED,"ESTA ES LA SEGUNDA LINEA DEL CORREO"
|
|
LET subject = "ESTE ES EL SUBJECT DEL CORREO"
|
|
|
|
-- first, we initialize the module
|
|
CALL ui.Interface.frontCall("WinMail", "Init", [], [id])
|
|
|
|
-- Set the body of the mail
|
|
CALL ui.interface.frontCall("WinMail", "SetBody", [id, cuerpo_correo], [result])
|
|
|
|
-- Set the subject of the mail
|
|
CALL ui.interface.frontCall("WinMail", "SetSubject", [id, subject], [result])
|
|
|
|
|
|
-- Set the mail sender
|
|
CALL ui.Interface.frontCall("WinMail", "SetFrom", [id, "mySelf", "jsoto@marmotech.com.do"], [result])
|
|
|
|
-- Set the SMTP server
|
|
CALL ui.Interface.frontCall("WinMail", "SetSmtp", [id, "mail.marmotech.com.do"], [result])
|
|
|
|
-- Add an Addressee as "TO"
|
|
CALL ui.Interface.frontCall("WinMail", "AddTo", [id, "myBoss", "jsoto@mastercentury.com"], [result])
|
|
|
|
-- Add another Addressee as "BCC"
|
|
CALL ui.Interface.frontCall("WinMail", "AddBCC", [id, "my friend", "juan.f.sotoc@gmail.com"], [result])
|
|
|
|
-- Add Two attachments
|
|
--CALL ui.Interface.frontCall("WinMail", "AddAttachment", [id, "c:\\mydocs\report.doc"], [result])
|
|
--CALL ui.Interface.frontCall("WinMail", "AddAttachment", [id, "c:\\mydocs\demo.png"], [result])
|
|
|
|
-- Send the mail via smtp
|
|
CALL ui.Interface.frontCall("WinMail", "SendMailSMTP", [id], [result])
|
|
IF result == TRUE THEN
|
|
DISPLAY "Message sent succesfuly"
|
|
ELSE
|
|
CALL ui.Interface.frontCall("WinMail", "GetError", [id], [str])
|
|
DISPLAY str
|
|
END IF
|
|
CALL ui.Interface.frontCall("WinMail", "Close", [id], [result])
|
|
|
|
END FUNCTION |