-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve format of SendGridHelper docs (#611)
Improves format of SendgridHelper docs, including an incorrect indentation in code sample that caused to be formatted incorrectly.
- Loading branch information
Showing
1 changed file
with
36 additions
and
28 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 |
---|---|---|
|
@@ -63,8 +63,10 @@ defmodule Bamboo.SendGridHelper do | |
end | ||
|
||
@doc """ | ||
An array of category names for this email. A maximum of 10 categories can be assigned to an email. | ||
Duplicate categories will be ignored and only unique entries will be sent. | ||
Sets a list of categories for this email. | ||
A maximum of 10 categories can be assigned to an email. Duplicate categories will | ||
be ignored and only unique entries will be sent. | ||
## Example | ||
|
@@ -87,6 +89,7 @@ defmodule Bamboo.SendGridHelper do | |
|
||
@doc """ | ||
Add a property to the list of dynamic template data in the SendGrid template. | ||
This will be added to the request as: | ||
``` | ||
|
@@ -104,7 +107,6 @@ defmodule Bamboo.SendGridHelper do | |
], | ||
``` | ||
The tag can be of any type since SendGrid allows you to use Handlebars in its templates | ||
## Example | ||
|
@@ -126,7 +128,8 @@ defmodule Bamboo.SendGridHelper do | |
do: raise("expected the name parameter to be of type binary or atom, got #{field}") | ||
|
||
@doc """ | ||
An integer id for an ASM (Advanced Suppression Manager) group that this email should belong to. | ||
Set the ASM (Advanced Suppression Manager) group that this email should belong to. | ||
This can be used to let recipients unsubscribe from only a certain type of communication. | ||
## Example | ||
|
@@ -144,8 +147,9 @@ defmodule Bamboo.SendGridHelper do | |
end | ||
|
||
@doc """ | ||
A boolean setting to instruct SendGrid to bypass list management for this | ||
email. If enabled, SendGrid will ignore any email supression (such as | ||
Instruct SendGrid to bypass list management for this email. | ||
If enabled, SendGrid will ignore any email supression (such as | ||
unsubscriptions, bounces, spam filters) for this email. This is useful for | ||
emails that all users must receive, such as Terms of Service updates, or | ||
password resets. | ||
|
@@ -166,8 +170,10 @@ defmodule Bamboo.SendGridHelper do | |
|
||
@doc """ | ||
Instruct SendGrid to enable or disable Google Analytics tracking, and | ||
optionally set the UTM parameters for it. This is useful if you need to | ||
control UTM tracking parameters on an individual email basis. | ||
optionally set the UTM parameters for it. | ||
This is useful if you need to control UTM tracking parameters on an individual email | ||
basis. | ||
## Example | ||
|
@@ -225,7 +231,7 @@ defmodule Bamboo.SendGridHelper do | |
end | ||
|
||
@doc """ | ||
Add SendGrid personalizations | ||
Add SendGrid personalizations. | ||
Each personalization can have the following fields: `to`, `cc`, `bcc`, | ||
`subject`, `headers`, `substitutions`, `custom_args`, or `send_at`. | ||
|
@@ -238,24 +244,24 @@ defmodule Bamboo.SendGridHelper do | |
## Example: | ||
base_personalization = %{ | ||
bcc: [%{"email" => "[email protected]", "name" => "BCC"}], | ||
subject: "Here is your email" | ||
} | ||
personalizations = | ||
Enum.map( | ||
[ | ||
%{to: "[email protected]"}, | ||
%{to: "[email protected]", send_at: 1_580_485_560} | ||
], | ||
&Map.merge(base_personalization, &1) | ||
) | ||
email = | ||
new_email() | ||
|> Email.put_header("Reply-To", "[email protected]") | ||
|> Bamboo.SendGridHelper.add_personalizations(personalizations) | ||
base_personalization = %{ | ||
bcc: [%{"email" => "[email protected]", "name" => "BCC"}], | ||
subject: "Here is your email" | ||
} | ||
personalizations = | ||
Enum.map( | ||
[ | ||
%{to: "[email protected]"}, | ||
%{to: "[email protected]", send_at: 1_580_485_560} | ||
], | ||
&Map.merge(base_personalization, &1) | ||
) | ||
email = | ||
new_email() | ||
|> Email.put_header("Reply-To", "[email protected]") | ||
|> Bamboo.SendGridHelper.add_personalizations(personalizations) | ||
""" | ||
@spec add_personalizations(Bamboo.Email.t(), [map]) :: Bamboo.Email.t() | ||
|
@@ -297,7 +303,9 @@ defmodule Bamboo.SendGridHelper do | |
end | ||
|
||
@doc """ | ||
A map of unique arguments for this email. This will override any existing unique arguments. | ||
Set a map of unique arguments for this email. | ||
This will override any existing unique arguments. | ||
## Example | ||
|