@nickbleyen wrote:
Hello, I'm struggling to add an image as attachment. I looked around on stackoverflow, this forum and the mailgun API documentation but i just can't figure it out. This is what I'm trying right now.
sendAtt(pictures: any[]){ var requestHeaders = new Headers(); requestHeaders.append("Authorization", "Basic " + this.apiKey); requestHeaders.append("Content-Type", "application/x-www-form-urlencoded"); this.http.request(new Request({ method: RequestMethod.Post, url: "https://api.mailgun.net/v3/" + this.mailgunUrl + "/messages", body: "from="+this.sender+"&to=" + this.recipient + "&subject=" + this.subject + "&text=" + this.message +"&attachment="+pictures[0] , headers: requestHeaders, })) .subscribe(success => { console.log("SUCCESS -> " + JSON.stringify(success)); }, error => { console.log("ERROR -> " + JSON.stringify(error)); }); }The email is actually getting sent but without the image. The array contains the base64images and it's the same array I use to show them in the application (where it does work).
Posts: 1
Participants: 1