f_email.srf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. $PBExportHeader$f_email.srf
  2. global type f_email from function_object
  3. end type
  4. forward prototypes
  5. global function integer f_email (string as_email_title, string as_email_add, string as_email_attach)
  6. end prototypes
  7. global function integer f_email (string as_email_title, string as_email_add, string as_email_attach);/************************************
  8. function:sent email by outlook
  9. paramdesc:as_email_add :email
  10. as_email_title :
  11. as_email_attach :
  12. ************************************/
  13. mailSession LmSes
  14. mailReturnCode LmRet
  15. mailMessage LmMsg
  16. mailFileDescription LmAttach
  17. string Ls_ret
  18. int Li_send
  19. LmSes = Create mailSession
  20. LmRet = LmSes.mailLogon ( mailNewSession! )
  21. If LmRet <> mailReturnSuccess! Then
  22. MessageBox ( "Mail Logon ", 'Return Code <> mailReturnSuccess! ' )
  23. LmSes.maillogoff()
  24. destroy LmSes
  25. return 1
  26. End If
  27. LmMsg.Subject = as_email_title
  28. LmMsg.notetext = ' '
  29. LmMsg.Recipient[1].name=as_email_add
  30. LmAttach.FileType = mailAttach!
  31. LmAttach.PathName = as_email_attach
  32. LmAttach.FileName = as_email_attach
  33. Li_send=Li_send+1
  34. LmMsg.AttachmentFile[1] = LmAttach
  35. LmRet = LmSes.mailsend ( LmMsg )
  36. if LmRet <> mailReturnSuccess! then
  37. LmSes.maillogoff()
  38. destroy LmSes
  39. return 1
  40. end if
  41. LmSes.maillogoff()
  42. destroy LmSes
  43. return 1
  44. end function