Skip to content

Commit

Permalink
Merge pull request #15 from sailshq/update-sendgrid-helper-inputs
Browse files Browse the repository at this point in the history
Update replyTo input (replyTo.email » replyTo.emailAddress)
  • Loading branch information
eashaw authored Sep 10, 2024
2 parents 5d63a7d + 1c41423 commit 9d8b370
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/private/sendgrid/send-html-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {

replyTo: {
example: {
email: '[email protected]',
emailAddress: '[email protected]',
name: 'Anne M. Martin'
},
description: 'The reply to email address and name for the email',
Expand Down Expand Up @@ -132,12 +132,15 @@ module.exports = {
let replyToAddress;
if(replyTo){ // [?]: https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#request-body
if(!replyTo.name){
throw new Error('Usage error!: When specifying a replyTo address, a "name" is required ex: { email: \'[email protected]\', name: \'Anne M. Martin\'}');
throw new Error('Usage error! When specifying a replyTo address, a "name" is required ex: { name: \'Anne M. Martin\', emailAddress: \'[email protected]\' }');
}
if(!replyTo.email){
throw new Error('Usage error!: When specifying a replyTo address, an "email" is required ex: { email: \'[email protected]\', name: \'Anne M. Martin\'}');
if(!replyTo.emailAddress){
throw new Error('Usage error! When specifying a replyTo address, an "emailAddress" is required ex: { emailAddress: \'[email protected]\', name: \'Anne M. Martin\'}');
}
replyToAddress = replyTo;
replyToAddress = {
name: replyTo.name,
email: replyTo.emailAddress
};
}

var formattedAttachments;
Expand Down

0 comments on commit 9d8b370

Please sign in to comment.