Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
0831690f
Unverified
Commit
0831690f
authored
Jul 12, 2021
by
neil
Committed by
GitHub
Jul 12, 2021
Browse files
Merge pull request #3595 from stevenzhu25/patch-1
Feature Request: Add sender name for SendGrid notify hook
parents
ac999339
849c3fd9
Changes
1
Show whitespace changes
Inline
Side-by-side
notify/sendgrid.sh
View file @
0831690f
...
...
@@ -37,11 +37,19 @@ sendgrid_send() {
fi
_saveaccountconf_mutable SENDGRID_FROM
"
$SENDGRID_FROM
"
SENDGRID_FROM_NAME
=
"
${
SENDGRID_FROM_NAME
:-
$(
_readaccountconf_mutable SENDGRID_FROM_NAME
)
}
"
_saveaccountconf_mutable SENDGRID_FROM_NAME
"
$SENDGRID_FROM_NAME
"
export
_H1
=
"Authorization: Bearer
$SENDGRID_API_KEY
"
export
_H2
=
"Content-Type: application/json"
_content
=
"
$(
echo
"
$_content
"
| _json_encode
)
"
if
[
-z
"
$SENDGRID_FROM_NAME
"
]
;
then
_data
=
"{
\"
personalizations
\"
: [{
\"
to
\"
: [{
\"
email
\"
:
\"
$SENDGRID_TO
\"
}]}],
\"
from
\"
: {
\"
email
\"
:
\"
$SENDGRID_FROM
\"
},
\"
subject
\"
:
\"
$_subject
\"
,
\"
content
\"
: [{
\"
type
\"
:
\"
text/plain
\"
,
\"
value
\"
:
\"
$_content
\"
}]}"
else
_data
=
"{
\"
personalizations
\"
: [{
\"
to
\"
: [{
\"
email
\"
:
\"
$SENDGRID_TO
\"
}]}],
\"
from
\"
: {
\"
email
\"
:
\"
$SENDGRID_FROM
\"
,
\"
name
\"
:
\"
$SENDGRID_FROM_NAME
\"
},
\"
subject
\"
:
\"
$_subject
\"
,
\"
content
\"
: [{
\"
type
\"
:
\"
text/plain
\"
,
\"
value
\"
:
\"
$_content
\"
}]}"
fi
response
=
"
$(
_post
"
$_data
"
"https://api.sendgrid.com/v3/mail/send"
)
"
if
[
"
$?
"
=
"0"
]
&&
[
-z
"
$response
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment