Mail Mailjet service

This service is used for sending transactional emails using providers like Mailjet or Mandrill

Register the service into your main.go file:

registry.ServiceProviderMail(mail.NewMailjet)
1

and you should register the entity MailTrackerEntity into the ORM Also, you should put your credentials and other configs in your config file

mail:
  mailjet:
    api_key_public: ...
    api_key_private: ...
    default_from_email: test@coretrix.tv
    from_name: coretrix.com
    sandbox_mode: false
    whitelisted_emails:
      - "@coretrix.com"
  mandrill:
    api_key: ...
    default_from_email: test@coretrix.tv
    from_name: coretrix.com
1
2
3
4
5
6
7
8
9
10
11
12
13

If you set sandbox_mode=true we won't send real email to the customer.

BUT we allow sandbox_mode to be disabled only for specific emails or domains. That's why we created config param called whitelisted_emails All emails or domains defined in this config param will be sent to receiver even if sandbox is enabled.

The idea is to be able to test the platform and in the same time to be sure that real emails are not sent to customers.

Access the service:

service.DI().Mail()
1

Some functions this service provide are:

    GetTemplateKeyFromConfig(templateName string) (string, error)
    SendTemplate(ormService *beeorm.Engine, message *Message) error
    SendTemplateWithAttachments(ormService *beeorm.Engine, message *MessageAttachment) error
    GetTemplateHTMLCode(templateName string) (string, error)
1
2
3
4