Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sendEmailTest(from:string, to:string, subject:string, text:string, html:string, inlines:Array<any>):Promise<any> {
var mailgunUrl = "" + this.domain + "/messages";
var mailgunApiKey = "api:key-e0b78e9e1c5e1c3135d3dfdf47ec2c60"
var headers = new Headers();
headers.append('Authorization', "Basic " + mailgunApiKey); // base64 encoding is missing
headers.append('Content-Type', "application/x-www-form-urlencoded");
//headers.append("enctype", "multipart/form-data");
var body:FormData = new FormData();
//body.append("enctype", "multipart/form-data");
body.append('from', 'Mailgun Sandbox <>');
body.append('to', 'my register <>');
body.append('subject', subject);
body.append('text', text);
body.append('html', html);
//inlines.forEach((inline) => {
//body.append('inline',, inline.filename);
let options = new RequestOptions({ headers: headers });
return mailgunUrl, options)
.map(res => res.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment