Angular4 Send Email using PHP - Email sending with Angular4

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 :  Vuejs Computed Properties - Vue Watch Completed property

Step : 1 email.php

email;
	$comments = $get_data->comments;
	$email_form_name = $get_data->name;
 
	$live_to_email = $get_form_email_address;
	$contact = "<p><strong>Your Name:</strong> $email_form_name</p><p><strong>Your Email:</strong> $get_form_email_address</p>";
	$data_conent = "<p>$comments</p>";
 
	$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');
}
?>

Step : 2 html

<form>
  <div>
    <label for="name">Client Name</label>
    
  </div>
  <div>
    <label for="email">Client Email</label>
    
  </div>
  <div>
    <label for="comments">Client Enter Message</label>
    <textarea rows="6" name="comments"></textarea>
  </div>
  <button type="submit">Submit</button>
</form>

Step : 3 component

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

import { Component } from '@angular/core';
import { AppService, IMessage } from './app.service';
 
@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);
    })
  }
}

Step : 4 service

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)
      })
  }
}

Example

READ :  Angular 6 CRUD Operations with PHP and MySQLi

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.