The Telligent Evolution Platform uses Mail Gateway for its email functionality. Mail Gateway can be broken down into two components: Incoming and outgoing. The incoming component consists of the Mail Gateway service that is installed on the machine. It receives emails into it (via POP3, IMAP, or from a directory) and converts them into posts on the site. The outgoing component sends emails out to users, notifying them of activity on the site. This document covers the outgoing component of Mail Gateway.
Services and utilities
These services are used to accomplish the various tasks required by Mail Gateway to send email notifications. Almost all of the services have a matching interface and can be extended/replaced via the module entries. It is not advisable to do this with any of the services unless you know what you're doing.
EmailBuilder
This service is responsible for rendering the different parts of the email (subject and body) through the Velocity engine and building the resulting email string. It also inserts all the headers used in the email. This service is used internally by the EmailSendingService.
EmailChecks
This service encapsulates a variety of checks for email. All email providers respect these settings when sending users email. Any new providers must do so, also. The service offers the following checks:
|
Method
|
Checks
|
Notes
|
|
EmailEnabled()
|
Site has email enabled
|
No emails will be generated if this is disabled.
|
|
CanSendEmail(User)
|
User has email enabled and has a email set
|
None.
|
|
CanSendNotification(User)
|
User has enabled notification emails
|
Also checks that the user has email enabled. This is checked for all emails that send content notifications (forum posts, wiki page updates, etc.).
|
|
EmailDigestEnabled()
|
Site has email digest enabled
|
Also checks that email is enabled.
|
|
CanSendConversationNotification(User)
|
User allows conversations updates via email
|
Also checks that the user has email enabled.
|
|
CanSendStatusNotification(User)
|
User allows status replies notifications via email
|
Also checks that the user has email enabled.
|
|
CanSiteContactUser(User)
|
User allows site admins to contact via email
|
Also checks that the user has email enabled.
|
|
CanPartnersContactUser(User)
|
User allows the site's partners to contact via email
|
Also checks that the user has email enabled.
|
EmailContext
This object stores context data for the email being generated. This data includes who the email is from, what user(s) it is direct to, email headers, and objects considered in context. These last objects are used to pass specific data from the email code to the template to be used in rendering. Only one of any given type can be added to the context (i.e., a User and a Forum Post can both be added to the context, but two different User objects cannot). If more than one of a particular type of object needs to be added to the context, a wrapper object should be used instead.
Note: EmailContext should not be created using new, use EmailContextService.Create() instead.
EmailContextService
This service is used to create, retrieve, and clear the EmailContext. When creating an EmailContext, context items are passed in as parameters. It is still possible to add further items via EmailContext.AddContextItem(object). Once created, the EmailContext is stored in the CSContext Items with the name "EmailContext" so it can be retrieved when rendering the email. The EmailContext is automatically cleared once the email is queued in the EmailSendingService.
EmailDigestStrategy
This class defines the start and end dates to use when retrieving activity messages used by the email digest feature. For daily digests, it returns from 12:00am of the previous day to 11:59:59pm of the previous day. For weekly digests, it returns from 12:00am 7 days prior to 11:59:59pm of the previous day.
EmailQueuingService
This service is responsible for rendering an email template and queuing it to be sent by the EmailJob. It delegates rendering the template to EmailBuilder. This service is the only way email should be queued into the EmailJob.
EmailTemplateExtensionService
This service is responsible for creating the Velocity context used when rendering templates and injecting all plugins that extend the IEmailTemplateExtension interface into the context.
EmailTemplateLoader
This service loads template files into the system for the EmailTemplateService. It looks in "/Web/Languages/<supported_language>/emails" (where <supported_language> is any language declared in /Web/Languages/languages.xml) for all xml files and attempts to load them as an email template. For any templates that fail to load, an exception is logged and the file is skipped.
EmailTemplateSerializer
This service is responsible for deserializing email template .xml files into EmailTemplate objects. It will log an EmailTemplateParseError exception for any templates that it cannot properly deserialize.
EmailTemplateService
This service loads and stores all EmailTemplates. Email providers will use this service to retrieve the desired email template, optionally specifying the language. If no language is provided or the language is no supported, the default language will be used. An EmailTemplateNotFound exception will be thrown if no email template is found.
EmailTemplateUtility
This class is responsible for a wide variety of email rendering related tasks. It formats the To and From fields, renders content to either html or plain text, despite its original format, and parsing strings into various objects, among others. It is available in code and is also exposed in the email templates using the $email_utility token.
If, during the process of rendering a email, it is determined the email should not be sent, the template can call $email_utility.CancelEmail() to halt email rendering
Data flow for sending emails
The following chart shows how emails are generated and sent. Any custom emails will follow a similar pattern.

Email providers
Email providers encapsulate the email sending process into a single method call. They take in the necessary information and trigger the appropriate email to be sent. Below are the various methods defined for each of the providers, the template(s) they use to send email, and a description of what they do.
Common
|
Method
|
Template Used
|
Description
|
|
FollowNotification
|
follower_notification
|
Notify a user when someone starts following them.
|
|
FriendshipApproved
|
friendship_request_approved
|
Notify the user requesting friendship that the request was approved.
|
|
FriendshipRequested
|
friendship_request
|
Notify the user that someone has requested to be their friend.
|
|
QueueContactRequest
|
contactrequest
|
Notify a user of a message sent from another user. Contact blog author uses this.
|
|
UserAccountApproved
|
newuser_approved
|
Notify a user that his/her membership to the site has been approved.
|
|
UserAccountLocked
|
user_accountlocked
|
Notify a user that his/her account has been temporarily locked because of too many failed login attempts.
|
|
UserAccountPending
|
newuser_pending
|
Notify a user that his/her membership to the site is pending approval.
|
|
UserAccountRejected
|
newuser_rejected
|
Notify a user that his/her membership to the site has been rejected.
|
|
UserCreate
|
newuser_accountcreated
|
Notify a user that his/her account has been created.
|
|
UserCreateGeneratedPassword
|
newuser_generatedpassword
|
Notify a user that his/her account has been created and a temporary password has been automatically generated.
|
|
UserInvitation
|
user_siteinvitation/user_groupinvitation
|
Notify a user that he/she has been invited to the site or to a specific group.
|
|
UserPasswordChanged
|
user_changedpassword
|
Notify the user that his/her password has been changed.
|
|
UserPasswordForgotten
|
user_forgottenpassword
|
Notify the user that his/her password has been changed to a temporary generated password.
|
|
UserPasswordForgottenUID
|
user_resetpassword
|
Notify the user that he/she requested to reset his/her password. Email includes a link to reset it.
|
|
UsersInRole
|
message_to_users_in_role
|
Send a message to all users in a role. Used by the Mass Email feature.
|
Blogs
|
Method
|
Template Used
|
Description
|
|
WeblogTracking
|
blog_post or blog_comment
|
Notify a subscribed user of a new blog post or comment.
|
|
WeblogFeedbackModerationThreshold
|
blog_moderation
|
Notify blog owners that there is feedback waiting to be moderated.
|
|
WeblogFeedbackNotification
|
blog_feedback
|
Notify blog owners of new feedback if the blog or post is set to notify.
|
|
WeblogSubscriptionConfirmation
|
blog_confirmsubscription
|
Send an email confirming a blog subscription by an anonymous user.
|
Forums
|
Method
|
Template Used
|
Description
|
|
ForumTracking
|
forum_post or forum_post_mailgateway
|
Notify subscribed users of a new thread or reply. Forum_post_mailgateway is used if Mail Gateway is enabled a the forum has a mailing list set up.
|
|
AwaitingModeration
|
forum_post_mailgateway_awaitingapproval
|
Notify a user who posted via email (using Mail Gateway) that his/her post is awaiting approval.
|
|
NotifyForumDisabled
|
forum_disabled
|
Notify a user who posted via email (using Mail Gateway) that the forum being posted to is disabled.
|
|
NotifyModerators
|
forum_moderationneeded
|
Notify moderators that there are posts needing moderation.
|
|
NotifyNoPermission
|
forum_nopermission
|
Notify a user who posted via email (using Mail Gateway) that he/she does not have permission to post to that forum.
|
|
NotifyThreadStarterOfAnswer
|
forum_verifiedanswer
|
Notify the author that an answer to his/her question has been verified.
|
|
NotifyThreadStarterOfSuggestedAnswer
|
forum_suggestedanswer
|
Notify the author that an answer to his/her question has been suggested.
|
|
PostApproved
|
forum_postapproved
|
Notify the author that his/her post has been approved.
|
|
PostMoved
|
forum_postmoved
|
Notify the author that his/her post has been moved.
|
|
PostMovedAndApproved
|
forum_postapprovedandmoved
|
Notify a post author that his/her post has been approved and moved to a different thread.
|
|
PostRemoved
|
forum_postremoved
|
Notify the author that his/her post has been deleted.
|
|
Thread MovedTracking
|
forum_threadmoved_tracking
|
Notify users subscribed to a thread that was moved. Used when the user does have permission to see the moved thread.
|
|
ThreadMovedNoTracking
|
forum_threadmoved_notracking
|
Notify users subscribed to a thread that was moved. Used when the user does not have permission to see the moved thread.
|
|
ThreadMoveNotification
|
forum_threadmovenotification
|
Notify the author that a thread he/she were subscribed to has been moved.
|
Groups
|
Method
|
Template Used
|
Description
|
|
RequestAccess
|
group_accessrequest
|
Notify group owners that a user has requested access to the group.
|
|
AccessRequestAccepted
|
group_accessaccepted
|
Notify a user that his/her group request has been accepted.
|
|
AccessRequestRejected
|
group_accessrejected
|
Notify a user that his/her group request has been rejected.
|
|
RoleAdded
|
group_roleadded
|
Notify all users in a role that the role has been added to a group.
|
|
UserAdded
|
group_useradded
|
Notify a user that he/she has been added to a group.
|
Messages
|
Method
|
Template Used
|
Description
|
|
MediaGalleryCommentNotification
|
media_comment_notifyowners
|
Notify gallery owners of a new comment on one of the files if the file has comment notifications enabled.
|
|
MediaGalleryFileNotification
|
media_file
|
Notify gallery owners of a new file if the gallery has file notifications enabled.
|
|
MediaGalleryPostTracking
|
media_comment
|
Notify users subscribed to a file of comment being added.
|
Messages
|
Method
|
Template Used
|
Description
|
|
ConversationMessageSent
|
messages_conversation
|
Notify user of a new conversation.
|
|
MessageAlsoReplied
|
messages_also_replied
|
Notify users who have replied to a status message of a new reply.
|
| MessageDeletedBySpamBlocker
|
messages_spam_deleted_user
|
Notify a message author that his/her message has been deleted because it was detected to be spam.
|
|
MessageReplyReceived
|
messages_reply
|
Notify a status message author that his/her status has been replied to.
|
|
MessageSpam
|
messages_spam or messages_spam_deleted
|
Notify users in the role set in the Spam settings that a message has been marked as spam.
|
Wikis
|
Method
|
Template Used
|
Description
|
|
PageTracking
|
wikis_page_updated
|
Notify users subscribed to a wiki page that is has been updated.
|
|
PossibleSpamCommentNotification
|
wikis_comment_possiblespam
|
Emails all users in roles with permission to delete a wiki comment that has been marked as possible spam.
|
|
PossibleSpamPageNotification
|
wikis_page_possiblespam
|
Emails all users in roles with permission to delete a wiki page that has been marked as possible spam.
|
|
SpamCommentNotification
|
wikis_comment_definitespam
|
Emails all users in roles with permission to delete a wiki comment that has been marked as definite spam.
|
|
SpamPageNotification
|
wikis_page_definitespam
|
Emails all users in roles with permission to delete a wiki page that has been marked as definite spam.
|
Related information