-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add data residency for eu and global regions (#1390)
- Loading branch information
1 parent
b1c831f
commit eed8ba2
Showing
4 changed files
with
119 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Choosing a data-residency to send messages to | ||
|
||
Use the `setDataResidency` setter to specify which host to send to: | ||
|
||
Send to EU (data-residency: `https://api.eu.sendgrid.com/`) | ||
```js | ||
const sgMail = require('@sendgrid/mail'); | ||
sgMail.setDataResidency('eu'); | ||
const msg = { | ||
to: '[email protected]', | ||
from: '[email protected]', | ||
subject: 'Hello world', | ||
text: 'Hello plain world!', | ||
html: '<p>Hello HTML world!</p>', | ||
}; | ||
sgMail.send(msg); | ||
``` | ||
Send to Global region, this is also the default host, if the setter is not used | ||
(data-residency: `https://api.sendgrid.com/`) | ||
```js | ||
const sgMail = require('@sendgrid/mail'); | ||
sgMail.setDataResidency('global'); | ||
const msg = { | ||
to: '[email protected]', | ||
from: '[email protected]', | ||
subject: 'Hello world', | ||
text: 'Hello plain world!', | ||
html: '<p>Hello HTML world!</p>', | ||
}; | ||
sgMail.send(msg); | ||
``` | ||
|
||
## Limitations | ||
|
||
1. Emails can only be sent to two hosts for now; 'eu' (https://api.eu.sendgrid.com/) and 'global' (https://api.eu.sendgrid.com/) | ||
2. The default data-residency is https://api.sendgrid.com/ | ||
3. The valid values for `region` in `client.setDataResidency(region)` are only `eu` and `global`. Case-sensitive. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters