I am trying to send an email from a Google Apps Script function (using Amazon SES Javascript SDK) using the below code -
function sendemail(email,name,code,date,expiry,version) {
eval(UrlFetchApp.fetch("https://sdk.amazonaws.com/js/aws-sdk-2.1206.0.min.js").getContentText());
const configure = {
accessKeyId: "<mykeyid>",
secretAccessKey: "<myaccesskey>",
apiVersion: '2010-12-01',
region: 'us-east-1'
};
const ses = new AWS.SES(configure); //AWS is not defined error
//... rest of code
}
Now when I run the sendemail()
function, it says "AWS is not defined" - which means clearly there is something wrong with the way I am referencing the external file, hence its not able to find AWS. What am I doing wrong? I know it might sound like a silly question, but I am a beginner with JS hence a bit confused on what is wrong... please guide... Thanks! :)