Skip to content

Connecting Eclipse Dirigible with SendGrid SMTP Relay

Ivo Yakov· 5 min read

Recent changes in Gmail's policies allows Eclipse Dirigible users to send emails only via Workspace enabled accounts in G Suite and require workspace administration privileges. By connecting Eclipse Dirigible with Twilio SendGrid's SMTP Relay feature you can send emails with your personal gmail account.

INFO

SendGrid is a 3rd party service and charges/limits apply. Here you can find more information about their Email API Plans.

Setup SendGrid Account ​

  1. Create a SendGrid account at https://sendgrid.com.

  2. Login at https://app.sendgrid.com.

  3. Verify a single sender email:

    • Click Settings -> Sender Authentication -> Verify a Single Sender.
    • Enter the details of the email address that Eclipse Dirigible mails will be sent from.

    Create Single Sender

  4. Setup SMTP Relay:

    • Click Email API -> Integration Guide -> SMTP Relay.
    • Enter an API Key Name and click Create Key to get an API Key for your SendGrid SMTP Relay.
    • Notice the Configure your application section, the credentials from it will be used to configure the mail client.

    API Key

Setup Eclipse Dirigible ​

Prerequisites

You can follow the Setup guide on how to deploy Eclipse Dirigible locally or in the cloud.

  1. Add the following environment variables to your deployment:

    DIRIGIBLE_MAIL_USERNAME=apikey
    DIRIGIBLE_MAIL_PASSWORD=`<YOUR_API_KEY_HERE>`
    DIRIGIBLE_MAIL_TRANSPORT_PROTOCOL=smtps
    DIRIGIBLE_MAIL_SMTPS_HOST=smtp.sendgrid.net
    DIRIGIBLE_MAIL_SMTPS_PORT=465

    INFO

    Replace the &lt;YOUR_API_KEY_HERE&gt; placeholder with the SendGrid SMTP Relay API key.

  2. Restart the Eclipse Dirigible instance in order to apply the new environment variables.

Environment Variables

To get a complete list of all environment variables navigate to the Environment Variables page.

Send an Email with SendGrid SMTP Relay ​

  1. Login to your Eclipse Dirigible instance.

  2. Create new project.

  3. Create new Javascript ESM Service.

  4. Use the following sinippet to send emails:

    javascript
    import { client as mail } from "sdk/mail";
    
    const from = "`<YOUR_VERIFIED_SENDER_EMAIL_HERE>`";
    const to = "`<YOUR_RECIPIENT_EMAIL_HERE>`";
    const subject = "Subject";
    const content = "Hello World!";
    const subType = "html";
    
    mail.send(from, to, subject, content, subType);

    INFO

    Replace the &lt;YOUR_VERIFIED_SENDER_EMAIL_HERE&gt; and the &lt;YOUR_RECIPIENT_EMAIL_HERE&gt; placeholders with valid email addresses.

    Mail Delivered

Released under the EPL-2.0 License.