EmailSpec

Contents

General
CloudAssessSpec
CollegePreferenceService
CsvBuilder
DocumentService
DocumentSpec
EmailSpec
ExportSpec
MailchimpSpec
Mask
Money
Preferences
QualityResultSpec
ReportSpec
SmsSpec
SystemUserService
Database objects
ACLAccessKey
ACLRole
Account
AccountTransaction
Application
Article
ArticleProduct
Assessment
AssessmentClass
AssessmentSubmission
AttachmentData
Attendance
Banking
Certificate
ClassCost
ConcessionType
Contact
ContactRelation
ContactRelationType
CorporatePass
CorporatePassCourseClass
CorporatePassProduct
Country
Course
CourseClass
CourseClassTutor
CourseModule
CustomField
CustomFieldType
DefinedTutorRole
Discount
DiscountConcessionType
DiscountCourseClass
DiscountMembership
DiscountMembershipRelationType
Document
DocumentVersion
EmailTemplate
Enrolment
EntityRelation
ExportTemplate
Field
FieldConfiguration
FieldConfigurationScheme
FieldHeading
FundingSource
FundingUpload
FundingUploadOutcome
Import
Invoice
InvoiceDueDate
InvoiceLine
InvoiceLineDiscount
Language
Membership
MembershipProduct
Message
MessagePerson
Module
Note
Outcome
PayLine
PayRate
PaymentIn
PaymentInLine
PaymentMethod
PaymentOut
PaymentOutLine
Payslip
Preference
PriorLearning
Product
ProductItem
Qualification
Report
ReportOverlay
Room
SavedFind
Script
Session
SessionModule
Site
Student
StudentConcession
Survey
SystemUser
Tag
TagRelation
TagRequirement
Tax
TrainingPackage
Tutor
TutorAttendance
UnavailableRule
Voucher
VoucherPaymentIn
VoucherProduct
WaitingList
Enumerations
AccountTransactionType
AccountType
ApplicationStatus
AttachmentInfoVisibility
AttachmentSpecialType
AttendanceType
AvetmissStudentDisabilityType
AvetmissStudentEnglishProficiency
AvetmissStudentIndigenousStatus
AvetmissStudentLabourStatus
AvetmissStudentPriorEducation
AvetmissStudentSchoolLevel
ClassCostFlowType
ClassCostRepetitionType
ClassFundingSource
ClientIndustryEmploymentType
ClientOccupationIdentifierType
ConfirmationStatus
ContactDuplicateStatus
CourseClassAttendanceType
CourseEnrolmentType
CreditCardType
CreditLevel
CreditProviderType
CreditType
DeliveryMode
DeliverySchedule
DiscountType
EnrolmentStatus
EnrolmentVETFeeHelpStatus
EntityRelationType
ExpiryType
FieldConfigurationType
InvoiceType
KeyCode
KeyCollision
MessageStatus
MessageType
MoneyRounding
NodeSpecialType
OutcomeStatus
PaymentSource
PaymentStatus
PaymentType
PayslipStatus
PostcodeType
ProductStatus
ProductType
QualificationType
RecognitionOfPriorLearningIndicator
StudentCitizenship
StudentStatusForUnitOfStudy
StudyReason
SurveyTypeSource
SurveyVisibility
TriggerType
UsiStatus
VETFeeExemptionType
VoucherPaymentStatus

Email sending API. You can render email content from templates or a text string. If the recipient is a contact object and there is no attachment, the message is stored inside the onCourse database. If the recipient is an email address or there is an attachment, then the message is sent directly without storage. Simple usage example:

email {
    template "Enrolment Confirmation"
    bindings enrolment: e
    to c
}

The above example will render the template with the name "Enrolment Confirmation" and pass "enrolment" to that template with the value of the Enrolment e in the script. It will send that email to the contact c. You can optionally also pass a from address if you don't want to use the default email.from preference. And you can override the email address associated with a certain contact or send to a list of contacts.

email {
    template "Enrolment Confirmation"
    from "college@example.com"
    to c1, c2 >> "anotheremail@example.com"
    bindings enrolment: e
}

The only lines which are required are "template", "bindings" and "to" You can send emails to an email address (instead of a contact record) and attach a file, without storing this data inside onCourse. Usage example:

 email {
     from "admin@example.com"
     to "recipient@example.com"
     cc "ccrecipient@example.com"
     bcc "bccrecipient@example.com"
     subject "test email"
     content "test email content"
     attachment "accounts.csv", "text/csv", account_csv_data
 }

The only lines which are required are "to", "subject" and "content" or "to", "template" and "bindings" Email collision functionality. Allows to skip sending emails automatically if contact have already received email with specified key. Usage example:

email {
    template "Enrolment Confirmation"
    bindings enrolment: e
    to c
    key "ABC", c
    keyCollision "drop"
}

 
        public 
        EmailSpec
     {
}

Instance methods

attachment(contentType, content)

Add attachment to the email. Using this method means that the message is not stored inside onCourse.

String contentType

MIME type of the attachment

Object content

MIME type of the attachment

attachment(fileName, contentType, content)

Add attachment to the email. Using this method means that the message is not stored inside onCourse.

String fileName

attached file name which will appear in the email

String contentType

MIME type of the attachment

Object content

attachment object

attachment(attachment)

Add attachment to the email. Using this method means that the message is not stored inside onCourse.

Map<String, Object> attachment

attachment properties map, e.g. [fileName: 'example.txt', type: 'text/plain', content: 'test text']

bcc(recipients)

Set BCC recipients for the email. Using this method means that the message is not stored inside onCourse.

String recipients

email address of the BCC recipients

bindings(bindings)

Set bindings necessary for rendering of the specified email template.

Map<String, Object> bindings

binding mappings required for rendering email template

cc(recipients)

Set CC recipients for the email. Using this method means that the message is not stored inside onCourse.

String recipients

email addresses of the CC recipients

content(content)

Set plain text content of the email. Could be used only for SMTP email sending

String content

plain text content of the email

createdBy(user)

Specify SystemUser who will be the linked to the resulting Message record in onCourse as its creator.

SystemUser user

user who created the email

from(email)

Set "from" address for the email. Defaults to "email.from" preference if not set.

String email

email from address

from(email, name)

Set "from" address for the email and name of the sender.

String email

email from address

String name

name of the sender

key(key, object)

Attach a string key to this message and link it to an object. This reference can be used to ensure duplicates aren't sent for the same event.

String key

a string key which identifies the script or event which creates this message

PersistentObject object

key is attached to a specific object (for example an enrolment or student)

keyCollision(collision)

Defines a rule to prevent duplicates being sent.

String collision

check type. Can be 'accept' (this is the default and means the key is ignored), 'drop' (which will silently drop the message) and 'error' (which will drop the message and log an error to the audit log).

multipartType(multipartType)

Specify multipart message type (default is "mixed"). Using this method means that the message is not stored inside onCourse.

String multipartType

multipart message type

subject(subject)

Set email subject.

String subject

email subject

template(templateName)

Set email template to be used for rendering email body. Could be used for Email and SMTP email sending

String templateName

name of the email template

to(recipients)

Specify contacts which will receive email. By default email specified in contact record will be used, however you can override the default email by using ">>" operator, e.g. contact1 >> "anotheremail@example.com"

Contact recipients

contact records who will receive the email

to(recipients)

Set recipients for the email. Using this method means that the message is not stored inside onCourse.

String recipients

email addresses of the email recipients