If you wish to integrate an email provider on your CoreConnect application, you can do so by enabling one of these plugins in your Functions service.
Each email type should be linked to a specific Queue on your queuing system (e.g. reset-password-email-default
)
SendGrid
With this plugin you can integrate your SendGrid account with your CoreConnect application. This plugin should only be installed in the Functions service, it automatically registers queues for signUp and resetPassword emails. Additional queues can be added via custom plugins.
Name | CoreConnect.Email.SendGrid |
Choice | true |
Configuration name | EmailSettings |
Configuration | { "APIKey": "", "SenderName": "noreply", "SenderEmail": "[email protected]", "EmailTemplates": [], "Actions": { "Registration": "Registration", "ResetPassword": "ResetPassword", "Wishlist": "Wishlist" }, "TemplateVariables": [ { "Key": "Registration", "TokenName": "accountCreationToken" }, { "Key": "PasswordReset", "TokenName": "resetPasswordToken" }, { "Key": "Wishlist", "TokenName": "" } ] } |
Consumers Plugin
This plugin should be installed in the Functions service along with one email provider plugin (e.g. SendGrid), it automatically registers queues for signUp and resetPassword emails.
Name | CoreConnect.Email.ConsumersPlugin |
Choice | true |
Configuration | There is no specific configuration for this plugin |
Technical details
Once you have activated an email provider plugin in your CoreConnect application, you will likely want to add new email types to be sent for specific events. This can be done directly on your service or via a custom plugin. These are the necessary steps to add a new email type:
- Create a new custom plugin (see Custom Plugins) and override the
RegisterQueues
method to add a new queue and a new consumer for your new email type. In this example it will be an email to be sent when a user’s wishlist is updated (e.g. one of the items’ price has been reduced):
- Create the classes for the email message and consumer:
- Add the configuration for the new email type on your email plugin’s configuration (e.g.
EmailSettings
for the SendGrid plugin):
- At this point your plugin is ready to send emails when a new message of type
WishlistEmailMessage
is published to thewishlist-changes-email-default
queue. You can now create a new service for the Gateway on your plugin to handle the logic and send a message to the queue when the event occurs.