Angular4 Send Email using PHP – Email sending with Angular4

Angular4 Send Email using PHP – Email sending with Angular4

In this Post We Will Explain About is Angular4 Send Email using PHP – Email sending with Angular4 With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Email sending with Angular4+ and PHPExample

In this post we will show you Best way to implement Angular4 Contact Form with Bootstrap and PHPMailer, hear for angular4 Send email with PDF attachment using PHP with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  How to Find The Total Number of Products in WP REST API v3?

Step : 1 email.php

[php]
email;
$comments = $get_data->comments;
$email_form_name = $get_data->name;

$live_to_email = $get_form_email_address;
$contact = “

Your Name: $email_form_name

Your Email: $get_form_email_address

“;
$data_conent = “

$comments

“;

$website = ‘Angularjs 4 with Php Email Address Example’;
$email_subject = “$website: FREE DOWNLOAD $email_form_name Wel-come”;

$mail_liveBody = ”;
$mail_liveBody .= “$contact $data_conent”;
$mail_liveBody .= ”;

$mail_head .= “MIME-Version: 1.0\r\n”;
$mail_head .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;
$mail_head .= “From: $get_form_email_address\n”;
$mail_head .= “Reply-To: $get_form_email_address”;

mail($live_to_email,$email_subject,$mail_liveBody,$mail_head);

$live_resarr[‘status’] = ‘success’;
$live_resarr[‘from’] = $get_form_email_address;
echo json_encode($live_resarr);
echo json_encode($get_form_email_address);
header($live_resarr);
return $get_form_email_address;
} else {
$live_resarr[‘status’] = ‘error’;
echo json_encode($live_resarr);
header(‘Location: /error.html’);
}
?>
[/php]

Step : 2 html

[php]



[/php]

Step : 3 component

[php]
import { Component } from ‘@angular/core’;
import { AppService, IMessage } from ‘./app.service’;

READ :  AngularJS Modal Popup open and close from controller

@Component({
selector: ‘app-root’,
templateUrl: ‘./app.component.html’,
styleUrls: [‘./app.component.css’]
})
export class AppComponent {
title = ‘Angular js PHP Send Email Example Steps!’;
comments: IMessage = {};

constructor(private appService: AppService) {

}

live_SendMail(comments: IMessage) {
this.appService.live_SendMail(comments).subscribe(res => {
console.log(‘AppComponent Success’, res);
}, error => {
console.log(‘AppComponent Error’, error);
})
}
}
[/php]

Step : 4 service

[php]
import { Injectable } from ‘@angular/core’;
import { Http } from ‘@angular/http’;
import { Observable } from ‘rxjs/Observable’;
import { Resolve } from ‘@angular/router’;
import ‘rxjs/add/operator/map’;
import ‘rxjs/add/operator/catch’;

export interface IMessage {
name?: string,
email?: string,
comments?: string
}

@Injectable()
export class AppService {
private liveUrl = ‘https://infinityknow.com/admin/assets/email.php’;

constructor(private http: Http) {

}

live_SendMail(comments: IMessage): Observable | any {
return this.http.post(this.liveUrl, comments)
.map(response => {
console.log(‘Sending your live24u email Address was very successfull’, response);
return response;
})
.catch(error => {
console.log(‘Sending your email Address got some error’, error);
return Observable.throw(error)
})
}
}
[/php]

READ :  Vue js array Updating - VueJS update object properties

Example

I hope you have Got What is Email sending with Angular4+ and PHP steps And how it works.I would Like to have FeadBack From My Blog(infinityknow.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Leave a Reply

Your email address will not be published.