Skip to content

Sending email from your website

Let your website send mail from your own domain name, for example when someone fills in your contact form.

With Sending email, your website can send mail itself from your own domain name. For example a notification to you when someone fills in your contact form, or a confirmation to a customer after booking an appointment. On this page you switch it on and tell your AI assistant how to use it.

#What you need

  • A website at Switchboard.
  • Preferably your own domain name, already connected (see Connect your own domain name). Then mails come from, for example, noreply@jansenbakery.com.

#Step 1: switch on Sending email

  1. Open Email. In your dashboard, go to your website and open Email.
  2. Flip the switch. Switch on Sending email and, if asked, pick the domain name you want to send from.
  3. Look at the records. You'll now see a few DNS records that are needed. More about them below.

#Step 2: the DNS records

To prove that your website may send mail on behalf of your domain name, a few records are needed in your DNS. In plain words:

Record What it does
DKIM (3 CNAME records with _domainkey in the name) A digital signature on every mail. The recipient can see that the mail really comes from your domain name and wasn't changed on the way.
SPF via MAIL FROM (an MX and a TXT record on bounce.yourdomain.com) Says which servers may send mail on your behalf. It sits on a separate subdomain, so your existing email settings don't change. Mails that can't be delivered come back there.
DMARC (a TXT record on _dmarc.yourdomain.com) Tells recipients what to do with mail that doesn't check out. Already have a DMARC record? Then we leave it in place.

How do these records get there?

  • Automatically: did you connect your domain automatically with an API key? Then we add these records straight away. You don't need to do anything.
  • Set up yourself: copy the records from the dashboard into your provider's settings, just like when you connected your domain name. See the general guide and your provider's guide. Use the copy buttons: the values are long.

#Step 3: wait for the check

After you add the records, our email partner checks that they're right. That's usually done within an hour, sometimes it takes up to a day. You'll see the status under Email in the dashboard. Everything green? Then your website can send mail.

After that your website needs to be restarted or published once, so it picks up the new settings. The dashboard tells you when that's needed.

#Step 4: tell your AI assistant

Once Sending email is on, your website automatically gets the settings it needs to send mail on our server:

Setting What it is
EMAIL_AWS_ACCESS_KEY_ID, EMAIL_AWS_SECRET_ACCESS_KEY The key your website uses to send mail. It only works for mail from your own domain name.
EMAIL_AWS_REGION Where the mail service runs, for example eu-central-1.
DEFAULT_FROM_EMAIL The sender address, for example noreply@jansenbakery.com. Your website may only send from this address.

You don't fill them in yourself. You'll see their names under Settings & secrets, in the Switchboard takes care of these block; you can't change them there, and you don't need to.

Your website sends the mail through Amazon SES, our mail partner, with its own key. That key can do one thing only: send mail from your own domain name. So even if someone got hold of it, they couldn't send mail in someone else's name with it.

The contact form of your starter website already does this by itself: it emails each new message to the address in the CONTACT_TO setting (your AI sets it up for you). For anything else, or if you changed the form, ask your AI assistant, for example:

Say to your AI assistant
I want my contact form to send an email to info@jansenbakery.com for every new message. Switchboard already puts the settings on the server: EMAIL_AWS_ACCESS_KEY_ID, EMAIL_AWS_SECRET_ACCESS_KEY, EMAIL_AWS_REGION and DEFAULT_FROM_EMAIL. Send the mail through the Amazon SES v2 API (not SMTP) and pass that EMAIL_AWS_ key and region explicitly; never use the AWS_ key of the file storage for this. Use DEFAULT_FROM_EMAIL as the sender and set the visitor's email address as Reply-To. If the settings are missing (like on my own computer), skip the email and only write a short note in the log, without the contents or the visitor's email address.

These settings don't exist on your own computer (the local preview). So you test on your real website, after publishing.

#Switching Sending email off

Switch it off again under Email. Your website can then no longer send mail. You can remove the DNS records at your provider afterwards, but you don't have to.

#Next step

Was this helpful?

Guide

Search the guide

Type a word or a question. Tip: press Ctrl K to open this anywhere.