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

21 lines
598 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));
}
}