A one-off bulk email sent to a set of groups or organisations, or a reusable template for such an email. It adds sending status to the recipient and content configuration held on BaseEmailJob. An administrator moves it to ready to send, a background dispatcher picks it up and marks it in progress, generates one EmailItem per recipient, and the job is marked completed once every item has been sent or has failed. A job whose group email type is TEMPLATE is never sent; it exists to be duplicated. Setting password reset makes sending generate a password reset token for each recipient, and a funnel repository can be linked so that opens and clicks feed a journey. Changes are audited, and deletion is soft.

Group: Database Entities

Extends: BaseEmailJob

Implements: Auditable


Properties

PropertyReturnsDescription
activebooleanWhether this job still has work to do, ie it has not been soft deleted and is either not started, ready to send or in progress. A completed or stopped job is not active.
auditOrgOrganisationOrganisation the audit trail for this job is recorded against, which is the organisation that owns the job.
disableTrackingImageBooleanWhether the invisible open-tracking image is left out of the email body. Setting it true means opens are not recorded for this job. May be null, meaning the image is included.
funnelRepositoryFunnelRepositoryJourney the recipients of this email are tracked against, so that opens, clicks and follow-up actions feed a funnel. Null when the email is not linked to a journey.
groupEmailTypeGroupEmailTypeWhether this row is an email to be sent, EMAIL, or a reusable template that is never sent, TEMPLATE. Null is treated as EMAIL by the finders, since it predates the field.
passwordResetBooleanWhether sending this email generates a single use password reset token for each recipient, so the email can carry a link that signs the recipient in to set a new password. May be null, meaning off; the passwordReset method gives the same answer without the null.
passwordResetLinkTextStringLink text to show for the generated password reset link in the email body. May be null, in which case the default wording is used.
statusStringWhere the job is up to, as a one letter code: r means an administrator has asked for it to be sent, p means the dispatcher is working through it, c means it has finished, and s means sending was stopped. Null means it has not been started, which is also the case while a preview is being sent.
statusDateDateWhen the status last changed. The completion check uses it to decide how long generation has been running, so it doubles as the time sending began. Never null.
templatebooleanWhether this row is a reusable template rather than an email to be sent. Templates are excluded from the ordinary group email listings and are meant to be duplicated.

Inherited from BaseEmailJob

Properties

PropertyReturnsDescription
assetQueryIdStringIdentifier of a query asset which selects the content the email is built from. When set, the first asset the query returns supplies the subject, from and reply-to values named by the asset field properties.
attachmentsList<EmailJobAttachment>Files attached to every email this job sends. Each attachment refers to blob store content by hash rather than holding the bytes. Null on a job which has never had an attachment added.
categoryBaseEmailCategoryCategory the job is filed under, used to group related jobs within an organisation. Optional.
deletedBooleanSoft deletion flag. A job with items or timers against it is flagged deleted and renamed rather than removed, so its history survives. Null means not deleted.
filterScriptMvelStringRecipient filter expressed as an MVEL expression, up to 1000 characters. Recipients the expression does not evaluate to true for are dropped before sending.
filterScriptXmlStringRecipient filter expressed as the XML rule format, up to 1000 characters. Recipients the rule does not evaluate to true for are dropped before sending.
fromAddressStringAddress the emails are sent from. If blank the sender falls back to the organisation's admin domain, or to a noreply address on the primary domain.
fromAssetFieldStringName of the field on the asset selected by the asset query which supplies the from address, overriding the job's own from address when it resolves to a value.
groupRecipientsList<GroupRecipient>The groups this job sends to. Each entry can be an exclusion instead, in which case members of that group are removed from the recipient set rather than added to it. Lazily loaded, and null on a job which has never had a group recipient added.
htmlStringThe email body, held as an MVEL template of up to 500000 characters and evaluated once per recipient.
idlongDatabase identifier for this job. The subclasses share a single joined inheritance table, so the id is unique across scheduled emails, group emails and triggers alike.
loginTokensBooleanWhether links in the email should carry an auto-login token for the recipient, so that following one signs them in. Null is treated as false.
nameStringUnique, path-safe identifier for the job within its organisation, used as the lookup key and in admin URLs. Required. Soft deleting a job renames it with a '-Deleted-' suffix and a timestamp so the original name becomes available again.
notesStringFree text notes about the job, up to 20000 characters. Copying a job with mimic prepends a 'Copied from' line naming the job it was copied from.
numEmailsIntegerNumber of emails this job has queued for sending, recorded when the batch is generated so progress can be reported against it. Null before a batch has been generated.
organisationRecipientsList<OrganisationRecipient>The organisations this job sends to, with the same include or exclude semantics as the group recipients. Lazily loaded, and null on a job which has never had an organisation recipient added.
recipientSelectorsStringSerialised recipient selection, up to 10000 characters, which is the newer replacement for the group and organisation recipient collections.
replyToAddressStringAddress replies are directed to. If blank the from address is used instead.
replyToAssetFieldStringName of the field on the asset selected by the asset query which supplies the reply-to address, overriding the job's own reply-to address when it resolves to a value.
subjectStringSubject line for the emails this job sends, up to 1024 characters, evaluated as an MVEL template per recipient. If it is blank the sender falls back to a generated subject built from the job title.
subjectAssetFieldStringName of the field on the asset selected by the asset query which supplies the subject line. Only consulted when an asset query id is set; the job subject is used if the field is empty.
themeSiteWebsiteWebsite whose live branch supplies the surrounding email template. When set, the generated body is wrapped in that site's email theme; when null the MVEL result is sent as-is.
timeToSendDateThe time the job is intended to be sent at. Null on jobs which are not scheduled for a particular time.
titleStringFree text display label for the job, shown in the admin UI and used in the fallback subject line. Unlike the name it carries no uniqueness or path-safety guarantee and may be null.
typeStringFree text classification set by the caller and carried across when a job is copied. Not the Hibernate inheritance discriminator, which is a separate column the application does not expose.

Methods

asScheduledEmail() · asEmailTrigger() · getId() · getName() · getTitle() · getNotes() · getSubject() · getFromAddress() · getReplyToAddress() · getGroupRecipients() · getOrganisationRecipients() · getThemeSite() · getHtml() · getFilterScriptXml() · getFilterScriptMvel() · getAssetQueryId() · getSubjectAssetField() · getFromAssetField() · getReplyToAssetField() · addGroupRecipient(Group g, boolean exclusion) · getType() · getAttachments() · getLoginTokens() · getDeleted() · getNumEmails() · getTimeToSend() · getRecipientSelectors() · deleted() · getCategory() · numEmails()

asScheduledEmail()

Returns: ScheduledEmail

Narrows this job to a ScheduledEmail, the recurring job type driven by a frequency and a start date.

asEmailTrigger()

Returns: EmailTrigger

Narrows this job to an EmailTrigger, the event driven job which also performs non-email actions.

getId()

Returns: long

Database identifier for this job. The subclasses share a single joined inheritance table, so the id is unique across scheduled emails, group emails and triggers alike.

getName()

Returns: String

Unique, path-safe identifier for the job within its organisation, used as the lookup key and in admin URLs. Required. Soft deleting a job renames it with a '-Deleted-' suffix and a timestamp so the original name becomes available again.

getTitle()

Returns: String

Free text display label for the job, shown in the admin UI and used in the fallback subject line. Unlike the name it carries no uniqueness or path-safety guarantee and may be null.

getNotes()

Returns: String

Free text notes about the job, up to 20000 characters. Copying a job with mimic prepends a 'Copied from' line naming the job it was copied from.

getSubject()

Returns: String

Subject line for the emails this job sends, up to 1024 characters, evaluated as an MVEL template per recipient. If it is blank the sender falls back to a generated subject built from the job title.

getFromAddress()

Returns: String

Address the emails are sent from. If blank the sender falls back to the organisation's admin domain, or to a noreply address on the primary domain.

getReplyToAddress()

Returns: String

Address replies are directed to. If blank the from address is used instead.

getGroupRecipients()

Returns: List<GroupRecipient>

The groups this job sends to. Each entry can be an exclusion instead, in which case members of that group are removed from the recipient set rather than added to it. Lazily loaded, and null on a job which has never had a group recipient added.

getOrganisationRecipients()

Returns: List<OrganisationRecipient>

The organisations this job sends to, with the same include or exclude semantics as the group recipients. Lazily loaded, and null on a job which has never had an organisation recipient added.

getThemeSite()

Returns: Website

Website whose live branch supplies the surrounding email template. When set, the generated body is wrapped in that site's email theme; when null the MVEL result is sent as-is.

getHtml()

Returns: String

The email body, held as an MVEL template of up to 500000 characters and evaluated once per recipient.

getFilterScriptXml()

Returns: String

Recipient filter expressed as the XML rule format, up to 1000 characters. Recipients the rule does not evaluate to true for are dropped before sending.

getFilterScriptMvel()

Returns: String

Recipient filter expressed as an MVEL expression, up to 1000 characters. Recipients the expression does not evaluate to true for are dropped before sending.

getAssetQueryId()

Returns: String

Identifier of a query asset which selects the content the email is built from. When set, the first asset the query returns supplies the subject, from and reply-to values named by the asset field properties.

getSubjectAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the subject line. Only consulted when an asset query id is set; the job subject is used if the field is empty.

getFromAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the from address, overriding the job's own from address when it resolves to a value.

getReplyToAssetField()

Returns: String

Name of the field on the asset selected by the asset query which supplies the reply-to address, overriding the job's own reply-to address when it resolves to a value.

addGroupRecipient(Group g, boolean exclusion)

Returns: GroupRecipient

Adds a group to this job's recipient list, creating the recipient collection if the job did not have one. The new link is attached to the in-memory job only; it is not saved, so the caller must persist it.

ParameterDescription
gthe group to send to, or to exclude
exclusiontrue to exclude the group's members rather than include them

getType()

Returns: String

Free text classification set by the caller and carried across when a job is copied. Not the Hibernate inheritance discriminator, which is a separate column the application does not expose.

getAttachments()

Returns: List<EmailJobAttachment>

Files attached to every email this job sends. Each attachment refers to blob store content by hash rather than holding the bytes. Null on a job which has never had an attachment added.

getLoginTokens()

Returns: Boolean

Whether links in the email should carry an auto-login token for the recipient, so that following one signs them in. Null is treated as false.

getDeleted()

Returns: Boolean

Soft deletion flag. A job with items or timers against it is flagged deleted and renamed rather than removed, so its history survives. Null means not deleted.

getNumEmails()

Returns: Integer

Number of emails this job has queued for sending, recorded when the batch is generated so progress can be reported against it. Null before a batch has been generated.

getTimeToSend()

Returns: Date

The time the job is intended to be sent at. Null on jobs which are not scheduled for a particular time.

getRecipientSelectors()

Returns: String

Serialised recipient selection, up to 10000 characters, which is the newer replacement for the group and organisation recipient collections.

deleted()

Returns: boolean

Null safe reading of the soft deletion flag.

getCategory()

Returns: BaseEmailCategory

Category the job is filed under, used to group related jobs within an organisation. Optional.

numEmails()

Returns: Long

The queued email count as a long, for callers which need a widened value.


Methods

asGroupEmail() · getStatus() · getStatusDate() · isPasswordReset() · getPasswordResetLinkText() · getFunnelRepository() · getGroupEmailType() · getDisableTrackingImage() · readyToSend() · completed() · inProgress() · isActive() · passwordReset() · getAuditOrg() · isTemplate()

asGroupEmail()

Returns: GroupEmailJob

Returns this job as a group email job, which it always is.

getStatus()

Returns: String

Where the job is up to, as a one letter code: r means an administrator has asked for it to be sent, p means the dispatcher is working through it, c means it has finished, and s means sending was stopped. Null means it has not been started, which is also the case while a preview is being sent.

getStatusDate()

Returns: Date

When the status last changed. The completion check uses it to decide how long generation has been running, so it doubles as the time sending began. Never null.

isPasswordReset()

Returns: Boolean

Whether sending this email generates a single use password reset token for each recipient, so the email can carry a link that signs the recipient in to set a new password. May be null, meaning off; the passwordReset method gives the same answer without the null.

getPasswordResetLinkText()

Returns: String

Link text to show for the generated password reset link in the email body. May be null, in which case the default wording is used.

getFunnelRepository()

Returns: FunnelRepository

Journey the recipients of this email are tracked against, so that opens, clicks and follow-up actions feed a funnel. Null when the email is not linked to a journey.

getGroupEmailType()

Returns: GroupEmailType

Whether this row is an email to be sent, EMAIL, or a reusable template that is never sent, TEMPLATE. Null is treated as EMAIL by the finders, since it predates the field.

getDisableTrackingImage()

Returns: Boolean

Whether the invisible open-tracking image is left out of the email body. Setting it true means opens are not recorded for this job. May be null, meaning the image is included.

readyToSend()

Returns: boolean

Whether an administrator has queued this job for sending and the dispatcher has not picked it up yet.

completed()

Returns: boolean

Whether the dispatcher has finished this job, meaning every generated email item has been sent or has failed.

inProgress()

Returns: boolean

Whether the dispatcher is currently generating or sending the emails for this job.

isActive()

Returns: boolean

Whether this job still has work to do, ie it has not been soft deleted and is either not started, ready to send or in progress. A completed or stopped job is not active.

passwordReset()

Returns: boolean

Whether password reset tokens are generated for recipients, treating null as false. Prefer this over isPasswordReset when all you want is a true or false answer.

getAuditOrg()

Returns: Organisation

Organisation the audit trail for this job is recorded against, which is the organisation that owns the job.

isTemplate()

Returns: boolean

Whether this row is a reusable template rather than an email to be sent. Templates are excluded from the ordinary group email listings and are meant to be duplicated.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.