Email.ecl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*##############################################################################
  2. ## HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®. All rights reserved.
  3. ############################################################################## */
  4. import lib_fileservices;
  5. RETURN MODULE
  6. /*
  7. * Sends an email message using a mail server.
  8. *
  9. * @param sendto A comma-delimited list of the addresses of the intended recipients.
  10. * @param subject The subject line.
  11. * @param body The text of the email to send.
  12. * @param server The name of the mail server. Defaults to GETENV(SMTPserver).
  13. * @param port The port number on the server to connect to. Defaults to GETENV(SMTPport)
  14. * @param sender The sender of the email. Defaults to GETENV(emailSenderAddress)
  15. */
  16. EXPORT SendEmail(varstring to, varstring subject, varstring body, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress')) :=
  17. lib_fileservices.FileServices.SendEmail(to, subject, body, mailServer, port, sender);
  18. /*
  19. * Sends an email message with a text attachment using a mail server.
  20. *
  21. * @param sendto A comma-delimited list of the addresses of the intended recipients.
  22. * @param subject The subject line.
  23. * @param body The text of the email to send.
  24. * @param attachment The text of the attachment to send. Must be a valid string with no embedded nulls.
  25. * @param server The name of the mail server. Defaults to GETENV(SMTPserver).
  26. * @param port The port number on the server to connect to. Defaults to GETENV(SMTPport)
  27. * @param sender The sender of the email. Defaults to GETENV(emailSenderAddress)
  28. */
  29. EXPORT SendEmailAttachText(varstring to, varstring subject, varstring body, varstring attachment, varstring mimeType, varstring attachmentName, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress')) :=
  30. lib_fileservices.FileServices.SendEmailAttachText(to, subject, body, attachment, mimeType, attachmentName, mailServer, port, sender);
  31. /*
  32. * Sends an email message with an arbitrary attachment using a mail server.
  33. *
  34. * @param sendto A comma-delimited list of the addresses of the intended recipients.
  35. * @param subject The subject line.
  36. * @param body The text of the email to send.
  37. * @param attachment The attachment to send.
  38. * @param mimeType The mem type of the attachment. E.g. 'text/plain; charset=ISO-8859-3'
  39. * @param attachmentName The name of the attachement - often a filename.
  40. * @param server The name of the mail server. Defaults to GETENV(SMTPserver).
  41. * @param port The port number on the server to connect to. Defaults to GETENV(SMTPport)
  42. * @param sender The sender of the email. Defaults to GETENV(emailSenderAddress)
  43. */
  44. EXPORT SendEmailAttachData(varstring to, varstring subject, varstring body, data attachment, varstring mimeType, varstring attachmentName, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress')) :=
  45. lib_fileservices.FileServices.SendEmailAttachData(to, subject, body, attachment, mimeType, attachmentName, mailServer, port, sender);
  46. END;