Change the email settings of a site
update_site_email_settings
Changes how a site's email appears in an inbox, from the sender name and sending address to the reply-to and open and click tracking.
Only the fields you send change, and the rest are left alone. An invalid value is refused with an error instead of being shortened or fixed up, and a call that sends none of the fields is refused with There was nothing to update! It does not turn sending on or off, which toggle_site_emails does, it does not change the allowance, and it never touches forwarding, which set_site_email_forwarding and the forwarding address tools change.
fromName is the sender name shown beside the sending address. By default it is the site's own name and keeps following it when the site is renamed, and a site with no name at all sends as Notifications. A custom name replaces it, and an empty string, or the site's current name itself, puts it back to following the site's name, which get_site_email_settings reports as fromNameFollowsSiteName.
fromLocal is the part of the sending address in front of the @. The rest is the domain the site sends from, its built-in sending domain (sendingDomain in get_site_email_settings) or the verified email domain chosen with set_site_email_sending_domain (selectedDomain), which this tool does not change. While one of the site's own email domains is chosen, even while fromFallback is true, changing fromLocal needs the Manage domains permission, and without it the change is refused with Changing the sending address on your own domain needs the Manage domains permission! Changing it changes the address every later message is sent from, which resets how mailboxes recognize the site, so the tool tells the client to change it only when you ask.
replyTo is where a reply goes. With none set, a reply reaches the sending address, which forwards it to the site's confirmed forwarding addresses while forwarding is on when repliesForwarded is true in get_site_email_settings, and otherwise lands in the mailboxes of the site's own email domain. Set one when somebody else should answer. See Who your email comes from.
Open and click tracking
trackEngagement turns open and click tracking on or off for the messages sent from then on, and it is on by default for every site. With it on, every HTML message gets an invisible tracking image and its links go through a tracking address, while plain text messages and a link with the ses:no-track attribute are left alone. Opens are approximate because some mail apps load images automatically and others block them, opens and clicks count for the whole message and never per recipient, and a site that tracks should tell its recipients, for example in its privacy policy.
The tool tells the client to turn tracking off when you ask, and to turn it back on only when you ask. Turning it on is refused with Open and click tracking is not set up on this server yet! while trackingAvailable is false in get_site_email_settings, and turning it off always works. See Track opens and clicks.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
fromName |
string | No | The sender name shown beside the sending address, at most 64 characters with no control characters. The default is the site's own name, and an empty string, or the site's name itself, goes back to following the site's name. |
fromLocal |
string | No | The sending address, meaning the part in front of the @, for example noreply, the default. Lowercase letters, digits, dots, dashes and underscores, starting and ending with a letter or digit, never two dots in a row, at most 32 characters. |
replyTo |
string | No | The address a reply is sent to, which should be a mailbox somebody reads. An empty string clears it. |
trackEngagement |
boolean | No | False to turn open and click tracking off for the messages sent from now on, true to turn it back on. It is on by default. |