1

Below is my code to send email using aws ses using nodejs.

ses.sendEmail( { 
           Source: sails.config.myconf.aws.emailFrom, 
           Destination: { ToAddresses: [useObj.email]},
           Message: {
               Subject:{
                  Data: subject
               },
               Body: {
                   Html: {
                       Data: template,
                   }
                }
           }
        }); 

It will work see attached image belowenter image description here but it show contact as name. Instead of this i want to add client name there.

rash111
  • 1,159
  • 3
  • 17
  • 34
  • Possible duplicate of [amazon-ses How can set name for email?](http://stackoverflow.com/questions/22141041/amazon-ses-how-can-set-name-for-email) – Daniel Aug 29 '16 at 06:06
  • i already checked this link and tried accepted answer but it wont work. – rash111 Aug 29 '16 at 06:12
  • 1
    You need to explain specifically what "it won't work" means. The solution in the referenced answer is correct -- you set the sending address to a string like `"Sender Name"
    `. If that doesn't work, then please explain in what way it fails.
    – Michael - sqlbot Aug 29 '16 at 11:30
  • Source: 'John Doe ', I tried by using this and it gives errors – rash111 Aug 29 '16 at 11:47

3 Answers3

4

Can you try sails.config.myconf.aws.emailFrom to be like

Sachin Sharma < sachin@enraiser.com >

reference 1

enRaiser
  • 2,298
  • 1
  • 15
  • 33
  • i tried MailFromDomain: 'clientName', it wont work. It says Unexpected key 'MailFromDomain' found in params. Do you know exact key to be used? – rash111 Aug 29 '16 at 06:13
1
Source: '"ABC Group" <'+sails.config.myconf.aws.emailFrom+'>';

Above code solve my problem.

rash111
  • 1,159
  • 3
  • 17
  • 34
  • Also tell , how it is different from what I proposed. logically I proposed the same thing. missing quote here and there does not make it a different answer. Instead of posting new answer you should have just corrected my answer. – enRaiser Sep 03 '16 at 05:19
1

You can set name is source (Source: "App Name!! app_email@example.com"). Example below

{
    Destination: {
        ToAddresses: ["example@example.com"]
    },
    Message: {
        Body: {
            Html: {
                Data: "YOUR MESSAGE"
            }
        },
        Subject: {
            Data: "YOUR SUBJECT"
        }
    },
    Source: "App Name!! <from_email@example.com>"
} 

https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/ses-examples-sending-email.html

Sanjeev Chauhan
  • 3,640
  • 3
  • 22
  • 29