openaire-library/utils/email/email.service.ts

22 lines
649 B
TypeScript

import {Injectable} from '@angular/core';
import {Http, Response, Headers, RequestOptions} from '@angular/http';
import {Email} from './email';
import {CustomOptions} from '../../services/servicesUtils/customOptions.class';
@Injectable()
export class EmailService {
constructor(private http:Http) {
}
sendEmail(url: string, email: Email) {
let body = JSON.stringify(email);
console.log(body);
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.do(request => console.log("Insert Response:"+request.status))
.map(request => request.json());
}
}