# EMailer

Inherits from: RHObject

EMailer is used to send e-mail and has a few advantages over the standard $Kernel.SMTPClient approach:

  • the port, host, and server defaults to the mail settings for notification (but can be changed);
  • recipients can be a user ID, username, group ID, group name, e-mail address, RHUser instance, or List;
  • adds CC to the message header (fixing a bug in $Kernel.SMTPClient);
  • BCC is supported;
  • add multiple attachments (from the filesystem or CS repository);
  • compose the mail body using markdown;
  • automatically wrap the text in a formatted HTML message (can be customized);
  • can be sent to multiple recipients or have each recipient recieve a personalized copy; and
  • queueing (for deferred sending).

Mail can be sent in one line of code. For example:

$RHCore.EMailer.New(prgCtx) \
	.addRecipients('Admin') \
	.addCCRecipients('DefaultGroup') \
	.setSubject('Server Restarted') \
	.setBody('The Content Server instance was restarted.') \
	.addAttachmentFile("C:/opentext/logs/abc.log") \
	.renderMD() \
	.setTemplate() \

See Sending E-Mail from OpenText Content Server for more information.

# Class Methods

# Inherited methods

Destructor ErrorAssoc OKAssoc

# IsValidEmailAddress

function Boolean IsValidEmailAddress(Dynamic emailAddress)

# ListifyRecipients

function List ListifyRecipients(Object prgCtx, Dynamic items)

# New

function Dynamic New(Object prgCtx, String subject='', String body='', String mimeType='text/plain')

# Overrides:

New in class RHObject

# Instance Methods

# Property Methods

Property methods can be accessed with the valueForKey method.

body bodymimetype classidentifier classname client clone context defaultfromsender defaultreplyto errorassoc fromaddress fullcgi hash host htmlify identityhashcode iterator methods okassoc port propertymethods rendermarkdown rendermd replyto send serialize server smtpconfiguration string subject template

# Inherited methods

assert cacheMethod cacheValueForKey callSuper checkError class classIdentifier className clone deserialize dict endTrans hash identityHashCode isAccessorMethod isCached isInstanceOf isProperty isPropertyMethod iterator methods pluck prepareForReuse propertyMethods removeFromCache reset resetCache respondsTo serialize setCacheValueForKey setValueForKey setValueForKeyPath setValues startTrans string super valueForKey valueForKeyPath

# addAttachmentFile

function Frame addAttachmentFile(String filePath, String displayName=File.GetName(filePath), String mimeType=$RHCore.FileUtils.GetMimeType(filePath))

# addAttachmentNode

function Frame addAttachmentNode(Dynamic item, String displayName=Undefined)

Item can be a DataID, nickname, RHNode, or RHNodeVersion

# addBCCRecipients

function Frame addBCCRecipients(Dynamic recipients)

# addCCRecipients

function Frame addCCRecipients(Dynamic recipients)

# addRecipients

function Frame addRecipients(Dynamic recipients)

# body

function Dynamic body()

# bodyMimeType

function Dynamic bodyMimeType()

# client

function Frame client()

# context

function Frame context()

# defaultFromSender

function String defaultFromSender()

# defaultReplyTo

function String defaultFromSender()

# fromAddress

function Dynamic fromAddress()

# fullCGI

function String fullCGI()

# getEmailAddress

function String getEmailAddress(Dynamic item)

# host

function Dynamic host()

# htmlify

function Frame htmlify()

# port

function Dynamic port()

# queue

function Assoc queue(Boolean oneEmailPerRecipient=false)

# renderMarkdown

function Frame renderMarkdown()

# renderMD

function Frame renderMD()

# replyTo

function Dynamic replyTo()

# resetSubclass

function Void resetSubclass()

# Overrides:

resetSubclass in class RHObject

# send

function Assoc send()

# server

function Dynamic server()

# setBody

function Frame setBody(Dynamic body)

# setBodyMimeType

function Frame setBodyMimeType(Dynamic bodyMimeType)

# setContext

function Frame setContext(Frame context)

# setFromAddress

function Frame setFromAddress(Dynamic fromAddress)

# setHost

function Frame setHost(Dynamic host)

# setPort

function Frame setPort(Dynamic port)

# setRecipient

function Frame setRecipient(Dynamic recipient)

# setReplyTo

function Frame setReplyTo(Dynamic replyTo)

# setServer

function Frame setServer(Dynamic server)

# setSubject

function Frame setSubject(Dynamic subject)

# setTemplate

function Frame setTemplate(Dynamic template="rhcore/email/email.html")

# setValueToTaskDataForKey

function Dynamic setValueToTaskDataForKey(Dynamic value, String key)

This writes a value to the fTaskData Assoc, which is passed to the mail queue.

# Parameters
  • value - The value to add to the taskdata.

  • key - The key.

# Returns
  • Returns this.

# subject

function Dynamic subject()

# template

function Dynamic template()

Last Updated: 3/28/2019, 2:48:37 PM