How to send mails using SMTP in your Betty Blocks application

In this article, you'll learn how to set up an SMTP configuration so you can send mails from your own mail server.

Robert van Boesschoten

Published: 03-08-2020

Last updated: 27-08-2020

Sending mails

In Betty Blocks, sending mails is a big part of a lot of workflows. Either for confirming a certain action, notifying users or sharing an update, mails are present in almost every application. By default, users can utilize the standard configuration provided by us (using Mandrill by Mailchimp). For some users, this option doesn't suffice and a more customizable option is required. If you are one of those users, SMTP can be a solution.

SMTP

But what exactly is SMTP? SMTP stands for Simple Mail Transfer Protocol, which is a highly used industry standard used since the early 80's. Although configuring your own SMTP setup can be a bit more technical than using Mandrill, it does come with some advantages. This article however is not aimed at learning you about SMTP itself, but to show you how you can enter SMTP credentials in your application. To learn more about SMTP, please take a look at this page.

Note: We do not provide an SMTP server, only the option to connect to it.

SMTP and the GDPR

Due to a recent ruling by the Court of Justice, European parties are required to house their SMTP services on European soil to not violate the GDPR. Please look into this when picking a provider if this applies to you. There are a lot of options, one of them being Microsoft's Office 365, also used in an example later on.

Configuring your SMTP setup

To start off using your SMTP server, you'll need to go to your application's settings in My Betty Blocks.
`https://my.bettyblocks.com/applications/*your-app-identifier*/settings/smtp`

There you'll see a form allowing you to enter a set of values to access your SMTP server.
Let's go through them one at a time.



To put each setting in perspective, let's use Microsoft's Office 365 settings as example for each value.

SMTP enabled: Toggle on to enable the SMTP settings.
Address: Fill in the address you want the emails to be sent from. Office 365 example: smtp.office365.com
Port: Fill in the port of your domain. Office 365 example: 587
Domain: Fill in the domain of your SMTP server. Used in Active Directory configurations.
Username: Fill in the username to login with into your SMTP server. Depends on the Authentication option Login. Office 365 example: user@domain.com
Password: Fill in the password to login with into your SMTP server. Depends on the Authentication option Login. Office 365 example: ******
Authentication: Choose what kind of authentication you want to use for the SMTP settings. Office 365 example: Required (choose the option Login)
Start TLS: Toggle on to enable SSL for your SMTP server. Office 365 example: Required/True

Note: All values differ for each user and provider. Please contact your provider for more information.

SPF and DKIM

Something not specified in the My Betty Blocks form, but important nonetheless are the SPF and DKIM records. These records need to be configured using your providers’ DNS control panel and are used to authenticate the mail processing by the Betty Blocks application.

SPF: Short for Sender Policy Framework. Required for every configuration. Add a TXT record containing a similar value to:

"v=spf1 ip4:123.123.123.123 include:subdomain.domain.com include:spf.mandrillapp.com"

In this example, we both used an IP address, but also included the format for a custom domain. These values differ for each provider/server. 

Note: Always include the Mandrillapp SPF as a fallback to use the default mailservice provided by the platform.


DKIM: Short for Domain Keys Identification Mail. Not always required, depends on the provider/server. Add a TXT record to a subdomain as specified by your provider of choice containing a similar value to:

v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrLHiExVd55zd/IQ/J/mRwSRMAocV/hMB3jXwaHH36d9NaVynQFYV8NaWi69c1veUtRzGt7yAioXqLj7Z4TeEUoOLgrKsn8YnckGs9i3B3tVFB+Ch/4mPhXWiNfNdynHWBcPcbJ8kjEQ2U8y78dHZj1YeRXXVvWob2OaKynO8/XXXXXXXX;


Testing

After setting up your SMTP configuration, press Save on the bottom of the form. Next, head to your application and run an action containing an Send mail event to see if it works!

Note: Using the SMTP option in your application will override the default mail configuration for mailing purposes in actions. It will not override the standard mailing used by the platform for 

  • Error notifications/Logs
  • Inviting users
  • Password reset
×

Not sure where to start?

Click here to register and start learning
Register