Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: XSJS - Unable to send mail with pdf attachment

$
0
0

Hi Thomas,

 

I tried changing the below code to access it as bytearray as you mentioned. Still it is not working.

 

var pdfDoc = $.request.entities[0].body.asArrayBuffer();

var mail = new $.net.Mail({

sender: {address: "abc@xxx.com"},

to: [{ address: "abc@xxx.com"}],

subject: "XSJS Email Test",

parts: [ new $.net.Mail.Part({

type: $.net.Mail.Part.TYPE_TEXT,

text:"Attachment Test",

contentType: "text/plain"

})]

});

mail.parts.push(new $.net.Mail.Part({

type: $.net.Mail.Part.TYPE_ATTACHMENT,

data: pdfDoc,

contentType: "application/pdf",

fileName: "Test.pdf"}));

var returnValue = mail.send();


I get the below error in browser console


POST http://xyz/WebContent/Services/EmailAttachment.xsjs 500 (Internal Server Error)      sap-ui-core.js:27 send                                                                                                                                                         sap-ui-core.js:27

Q.extend.ajaxindex-progress.html:1091 (anonymous function)                                                  sap-ui-core.js:27

Q.event.dispatch                                                                                                                                    sap-ui-core.js:27 v3.handle


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>