I am trying to send email using aws-sdk's SES in my Angular application (Angular 5).
ses = new AWS.SES({
apiVersion: '2010-12-01',
accessKeyId:'<<access key>>',
secretAccessKey:'<<secretkey>>',
region: 'us-east-1',
endpoint: 'email-smtp.us-east-1.amazonaws.com',
sslEnabled: true
});
this.ses.sendEmail(this.params, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
console.log("Got error:", err.message);
console.log("Request:");
console.log(this.request.httpRequest);
console.log("Response:");
console.log(this.httpResponse);
} else {
console.log(data); // successful response
}
});
I am getting the below error.
Failed to load https://email-smtp.us-east-1.amazonaws.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.
I don't find a way to set the header values here.