Send email with attachment (MAPI)Tag(s): Powerscript


mailsession lms_sess
mailmessage lm_mess
mailrecipient lm_recipient
mailFileDescription lmf_file
mailreturncode lmc_rc


lmf_file.FileType = mailAttach!
lmf_file.FileName = "report.psr"
lmf_file.PathName = "c:\temp\" + "report.psr"

lm_mess.NoteText = "this my report."
lm_mess.Subject = "report may2004"
lm_mess.Attachmentfile[1] = lmf_file

lm_recipient.Address = "someone@somewhere.com"
lm_recipient.Name = "Mr. Brown"
lm_recipient.RecipientType = mailTo!
lm_mess.Recipient[1] = lm_recipient

lms_sess = create mailsession
lmc_rc = lms_Session.mailLogon()
lmc_rc = lms_Session.mailSend(lm_Message)
IF lmc_rc <> mailReturnSuccess! THEN
        MessageBox("Error", "Error on Send")
END IF

lmc_rc = lms_sess.mailLogoff()
DESTROY lms_sess

blog comments powered by Disqus