Sometimes it is desirable for emailed reports sent by RStudio Connect to appear as if they were
sent by the content owner instead of the system email address configured by Server.SenderEmail. This is made possible by the Server.EmailFromUserAddresses setting, however, this does require additional steps by your email administrator. This article describes one possible configuration which utilizes Google Workspace as the SMTP provider.
First, create an SMTP Relay through the Google admin console:
- Navigate to Apps > Google Workspace > Gmail > Advanced Settings.
- Configure your SMTP relay service settings:
- From the 1. Allowed senders drop-down, select Only addresses in my domains.
- In the Authentication section, select the Require SMTP Authentication check box.
- In the Encryption section, select the Require TLS encryption check box.
- Click Save.
Next, enable "Mail delegation" for your organization's domain:
- Navigate to Apps > Google Workspace > Gmail > User Settings.
- In the Mail delegation pane, select the following:
- Let users delegate access to their mailbox to other users in the domain.
- Show the account owner and the delegate who sent the email.
Create a user account for sending system emails from RStudio Connect:
- Navigate to Users and click Add a user.
- Fill out the required fields and click Add a new user to save your changes.
Sign into the new user account created in the previous step.
Then, enable 2-step-verification and click App passwords to create a new App Password for RStudio Connect to use later.
When creating the App Password, click the Select device drop-down and select the option Other (Custom name).
Type a name for the device and click Generate.
Add the following configurations to RStudio Connect's main configuration file (rstudio-connect.gcfg):
IMPORTANT NOTE: Make sure to update the specified values in the configuration below before restarting Connect.
[SMTP]
Host = "smtp-relay.gmail.com"
Port = 465
SSL = true
; Replace this value with the email address created above
User = "rsconnect@rstudio.com"
; Replace this value with the App Password created above
Password = "app-password"
[Server]
; Replace this value with the email address created above
SenderEmail = "rsconnect@rstudio.com"
; EmailTo is required to prevent emails without a To: header from going to spam.
; Other recipients are specified with a BCC header
; Replace this value with the email address created above
EmailTo = "rsconnect@rstudio.com"
EmailFromUserAddresses = true
EmailProvider = SMTP
After restarting RStudio Connect, emailed reports will appear to be sent from the email address of the currently signed-in user. Scheduled report emails will now appear to be sent from the email address of the content owner.
To bypass spam filtering for senders within your domain, add an exception through the Google administration console. If you would like more fine-grained control over which senders are allowed to bypass the spam filter, you may use an approved sender address list as described here. Emails sent to or from an address outside your domain may be marked as spam. Check your spam folder if you don't see the message in your inbox.
Comments