Guest User

Untitled

a guest
Feb 18th, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. const AWS = require("aws-sdk");
  2.  
  3. AWS.config.update({
  4. accessKeyId: <<YOUR_ACCESS_KEY>>,
  5. secretAccessKey: <<YOUR_ACCESS_KEY>>,
  6. region: <<YOUR_ACCESS_KEY>>
  7. });
  8.  
  9. const ses = new AWS.SES({ apiVersion: "2010-12-01" });
  10. const params = {
  11. Destination: {
  12. ToAddresses: [""XYZ@XYZ.com""] // Email address/addresses that you want to send your email
  13. },
  14. ConfigurationSetName: <<ConfigurationSetName>>,
  15. Message: {
  16. Body: {
  17. Html: {
  18. // HTML Format of the email
  19. Charset: "UTF-8",
  20. Data:
  21. "<html><body><h1>Hello Charith</h1><p style='color:red'>Sample description</p> <p>Time 1517831318946</p></body></html>"
  22. },
  23. Text: {
  24. Charset: "UTF-8",
  25. Data: "Hello Charith Sample description time 1517831318946"
  26. }
  27. },
  28. Subject: {
  29. Charset: "UTF-8",
  30. Data: "Test email"
  31. }
  32. },
  33. Source: "ABC@ABC.com"
  34. };
  35.  
  36. const sendEmail = ses.sendEmail(params).promise();
  37.  
  38. sendEmail
  39. .then(data => {
  40. console.log("email submitted to SES", data);
  41. })
  42. .catch(error => {
  43. console.log(error);
  44. });
Add Comment
Please, Sign In to add comment