sapui5 - Amazon ses.sendEmail - how to attach pdf file? -
i trying attach pdf in email using amazon ses.sendemail. don't know param key it. without attachment working perfectly. here have tried.
` var ses = new aws.ses()
var params = { destination: { toaddresses: [ 'xxx', ] }, message: { body: { html: { data: msg, charset: 'utf-8' } }, subject: { /* required */ data: 'test mail', charset: 'utf-8' } }, attachment:{ }, source: 'yyy' }; ses.sendemail(params, function(err, data) { if (err) {// error occurred} odialog.close(); messagetoast.show("email not sent. problem occurred!"); } else { odialog.close(); messagetoast.show("email sent successfully!"); } });`
currently, can send attachments if use raw email api, e.g.:
var ses_mail = "from: 'your friendly ui5 developer' <" + email + ">\n" + "to: " + email + "\n" + "subject: aws ses attachment example\n" + "mime-version: 1.0\n" + "content-type: multipart/mixed; boundary=\"nextpart\"\n\n" + "--nextpart\n" + "content-type: text/html; charset=us-ascii\n\n" + "this body of email.\n\n" + "--nextpart\n" + "content-type: text/plain;\n" + "content-disposition: attachment; filename=\"attachment.txt\"\n\n" + "awesome attachment" + "\n\n" + "--nextpart"; var params = { rawmessage: { data: new buffer(ses_mail) }, destinations: [ email ], source: "'your friendly ui5 developer' <" + email + ">'" }; var ses = new aws.ses(); ses.sendrawemail(params, function(err, data) { if(err) { odialog.close(); messagetoast.show("email sent successfully!"); } else { odialog.close(); messagetoast.show("email sent successfully!"); } });
Comments
Post a Comment