Email.ecl 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 to 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 mailServer 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. * @param cc Optional comma-delimited addresses of carbon-copy recipients. Defaults to an empty string (none).
  16. * @param bcc Optional comma-delimited addresses of blind-carbon-copy recipients. Defaults to an empty string (none).
  17. * @param highPriority Optional; if true, message is sent with high priority. Defaults to false (normal priority).
  18. */
  19. EXPORT SendEmail(varstring to, varstring subject, varstring body, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress'), varstring cc='', varstring bcc='', boolean highPriority=false) :=
  20. lib_fileservices.FileServices.SendEmail(to, subject, body, mailServer, port, sender, cc, bcc, highPriority);
  21. /*
  22. * Sends an email message with a text attachment using a mail server.
  23. *
  24. * @param to A comma-delimited list of the addresses of the intended recipients.
  25. * @param subject The subject line.
  26. * @param body The text of the email to send.
  27. * @param attachment The text of the attachment to send. Must be a valid string with no embedded nulls.
  28. * @param mailServer The name of the mail server. Defaults to GETENV(SMTPserver).
  29. * @param port The port number on the server to connect to. Defaults to GETENV(SMTPport)
  30. * @param sender The sender of the email. Defaults to GETENV(emailSenderAddress)
  31. * @param cc Optional comma-delimited addresses of carbon-copy recipients. Defaults to an empty string (none).
  32. * @param bcc Optional comma-delimited addresses of blind-carbon-copy recipients. Defaults to an empty string (none).
  33. * @param highPriority Optional; if true, message is sent with high priority. Defaults to false (normal priority).
  34. */
  35. 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'), varstring cc='', varstring bcc='', boolean highPriority=false) :=
  36. lib_fileservices.FileServices.SendEmailAttachText(to, subject, body, attachment, mimeType, attachmentName, mailServer, port, sender, cc, bcc, highPriority);
  37. /*
  38. * Sends an email message with an arbitrary attachment using a mail server.
  39. *
  40. * @param to A comma-delimited list of the addresses of the intended recipients.
  41. * @param subject The subject line.
  42. * @param body The text of the email to send.
  43. * @param attachment The attachment to send.
  44. * @param mimeType The mime type of the attachment. E.g. 'text/plain; charset=ISO-8859-3'
  45. * @param attachmentName The name of the attachement - often a filename.
  46. * @param mailServer The name of the mail server. Defaults to GETENV(SMTPserver).
  47. * @param port The port number on the server to connect to. Defaults to GETENV(SMTPport)
  48. * @param sender The sender of the email. Defaults to GETENV(emailSenderAddress)
  49. * @param cc Optional comma-delimited addresses of carbon-copy recipients. Defaults to an empty string (none).
  50. * @param bcc Optional comma-delimited addresses of blind-carbon-copy recipients. Defaults to an empty string (none).
  51. * @param highPriority Optional; if true, message is sent with high priority. Defaults to false (normal priority).
  52. */
  53. 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'), varstring cc='', varstring bcc='', boolean highPriority=false) :=
  54. lib_fileservices.FileServices.SendEmailAttachData(to, subject, body, attachment, mimeType, attachmentName, mailServer, port, sender, cc, bcc, highPriority);
  55. END;