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

20 lines
540 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);
return this.http.post(url, body, CustomOptions.getAuthOptionsWithBody())
.map(request => request.json());
}
}