Reputation: 539
Hello, I am trying to send email with attachment ,using
var params = {
RawMessage: {
From: "[email protected]",
To: "[email protected]",
Date: new Date(),
Subject: "Hello",
"Accept-Language": "en-US",
"Content-Language": "en-US",
"Content-Type": "text/plain", charset: "us-ascii",
"Content-Transfer-Encoding": "quoted-printable",
"MIME-Version": 1.0,
Data: "Hello, I hope you are having a good day."
},
Destinations: [
"[email protected]"
],
Source: "[email protected]"
};
ses.sendRawEmail(params, function (err, data) {
if (err) console.log("err>>" + err, err.stack); // an error occurred
else console.log("data>>>" + JSON.stringify(data)); // successful response
});
but I am getting error
UnexpectedParameter: Unexpected key 'From' found in params.RawMessage * UnexpectedParameter: Unexpected key 'To' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Date' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Subject' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Accept-Language' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Content-Language' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Content-Type' found in params.RawMessage * UnexpectedParameter: Unexpected key 'charset' found in params.RawMessage * UnexpectedParameter: Unexpected key 'Content-Transfer-Encoding' found in params.RawMessage * UnexpectedParameter: Unexpected key 'MIME-Version' found in params.RawMessage
I know I am not using the correct format of params , but i have not got the right format anywhere, please help me..... Thanks in advance...
Upvotes: 1
Views: 5809
Reputation: 13500
According to the documentation, the field RawMessage
only contains a Data
property and nothing else. The Data
field contains an entire raw email message - including the headers and body (or bodies), all properly formatted (escaping, encoding) and delimited (proper number of newlines).
You might be looking for sendEmail
, which allows you to set headers such as the 'To', 'From' and 'Subject' fields as key-value
pairs.
Upvotes: 4