AngularJS Contact Form Send Email with Attachment using PHP

AngularJS Contact Form Send Email with Attachment using PHP

In this Post We Will Explain About is AngularJS Contact Form Send Email with Attachment using PHP 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 AngularJS Contact Form with Bootstrap and PHPMailerExample

In this post we will show you Best way to implement Angular Contact Form Example Send SMTP Mailer using PHP, hear for AngularJS PHP Contact Form Script – Messages Modulewith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Angular Date filtering and formatting JSON Data

index.html

[php]

AngularJS Contact Form with Bootstrap and PHPMailer

http://jquery.min.js
http://bootstrap.min.js
http://angular.js
http://app.js
http://controllers.js

Live Contact Form Example

{{ comment_msg }}

[/php]
Module -> controllers.js
[php]
var liveApp = angular.module(‘liveApp’, []);
[/php]

controllers.js

[php]
liveApp.controller(‘liveconCtrl’, function ($scope, $http) {
$scope.data_res = ‘hidden’
$scope.comment_msg;
$scope.live_formDta;
$scope.contact_form_submit = false;
$scope.form_submitted = false;
$scope.submit = function(live_contact) {
$scope.form_submitted = true;
$scope.contact_form_submit = true;
if (live_contact.$valid) {
$http({
method : ‘POST’,
url : ‘live-contact-form.php’,
data : $.param($scope.live_formDta),
headers : { ‘Content-Type’: ‘application/x-www-form-urlencoded’ }

}).success(function(data){
console.log(data);
if (data.success) {
$scope.contact_form_submit = true;
$scope.comment_msg = data.message;
$scope.data_res=’bg-success’;
} else {
$scope.contact_form_submit = false;
$scope.comment_msg = data.message;
$scope.data_res=’bg-danger’;
}
});
} else {
$scope.contact_form_submit = false;
$scope.comment_msg = ‘Error Failed :( Please Contact form fill out all the fields.’;
$scope.data_res=’bg-danger’;
}
}
});

READ :  Vuejs Expressions – Numbers Strings Objects Array eval using Vuejs

[/php]

live-contact-form.php

[php]
false, ‘message’ => ‘Please contact form fill out the all the fields form completely.’);
echo json_encode($res_dta);
exit;
}

$email = new PHPMailer();

$email->From = $_POST[‘live_input_email’];
$email->FromName = $_POST[‘first_input_name’];
$email->AddAddress(‘live24u@admin.com’); //recipient
$email->Subject = $_POST[‘live_subject’];
$email->Body = “Name: ” . $_POST[‘first_input_name’] . “\r\n\r\nMessage: ” . stripslashes($_POST[‘live_comments’]);

if (isset($_POST[‘live_refernce’])) {
$email->Body .= “\r\n\r\nRef: ” . $_POST[‘live_refernce’];
}

if(!$email->send()) {
$res_dta = array(‘success’ => false, ‘message’ => ‘Your Message can not be sent. some error Mailer Error: ‘ . $email->ErrorInfo);
echo json_encode($res_dta);
exit;
}

$res_dta = array(‘success’ => true, ‘message’ => ‘Thanks! success .!! We have some received your message.’);
echo json_encode($res_dta);

} else {

$res_dta = array(‘success’ => false, ‘message’ => ‘Please all the fill out the contact form completely.’);
echo json_encode($res_dta);

READ :  Angular4 Send Email using PHP - Email sending with Angular4

}
[/php]

Example

I hope you have Got What is How to Create Contact Form with PHPMailer to send mails using Angular 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 Comment