Академический Документы
Профессиональный Документы
Культура Документы
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
Laravel Easy
Installation (Larav
Home
Bootstrap Sinhala
Tutorial
Facebook Application
development
Web Applications
Facebook Share
Unlock
LOGIN
Username
Password
Remember Me
Log In
code .
AngularJS web Programming touch
. Google
publish free & open source JavaScript Library
FIND US ON FACEBOOK
Programmer.lk
809likes
, JavaScript Framework .
contact form 3 .
3 industry Libraries
LikePage
Bethefirstofyourfriendstolikethis
https://www.programmer.lk/angularjscontactformwithphpmailer/
POPULAR
RECENT
1/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
Facebook
Application
development
(ii)
email send .
Facebook
Application
development
(i)
VIEW DEMO
index.html
AngularJS
Contact Form
with PHPMailer
validation parts
January 8, 2016
<!DOCTYPE html>
December 30,
2015
Facebook
Share to Unlock
February 5, 2016
<html>
Next
<head>
<title>AngularJS Contact Form with PHPMailer</title>
https://www.programmer.lk/angularjscontactformwithphpmailer/
2/12
11/20/2016
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
<script src="controllers.js"></script>
</head>
<body ng-app="contactApp" >
<div class="vertical-middle">
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">Contact Form<
</div>
<div ng-controller="ContactController" class
<form ng-submit="submit(contactform)"
<div class="form-group" ng-class=
<label for="inputName" class=
<div class="col-lg-10">
<input ng-model="formData.inputName"
</div>
</div>
<div class="form-group" ng-class=
<label for="inputEmail" class
<div class="col-lg-10">
<input ng-model="formData.inputEmail"
https://www.programmer.lk/angularjscontactformwithphpmailer/
3/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
</div>
</div>
<div class="form-group" ng-class=
<label for="inputSubject" class
<div class="col-lg-10">
<input ng-model="formData.inputSubject"
</div>
</div>
<div class="form-group" ng-class=
<label for="inputMessage" class
<div class="col-lg-10">
<textarea ng-model="formData.inputMessage"
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10"
<button type="submit" class
Send Message
</button>
</div>
</div>
</form>
https://www.programmer.lk/angularjscontactformwithphpmailer/
4/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
app.js
Angular appmodule contactApp
variable assign .
1
controllers.js
index.html html form values, ajax
contact-form.php file . AngularJS
$http service . .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$scope.submitted = false; //used so that form errors are shown only after the form has been subm
$scope.submit = function(contactform) {
https://www.programmer.lk/angularjscontactformwithphpmailer/
5/12
11/20/2016
24
25
26
27
28
29
30
31
32
33
34
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
$scope.submitted = true;
$scope.submitButtonDisabled = true;
if (contactform.$valid) {
$http({
method: 'POST',
url : 'contact-form.php',
data: $.param($scope.formData),//param method from jQuery
headers : { 'Content-Type': 'application/x-www-form-urlencoded'
}).success(function(data){
console.log(data);
if (data.success) { //success comes from the return json object
$scope.submitButtonDisabled = true;
$scope.resultMessage = data.message;
$scope.result='bg-success';
} else {
$scope.submitButtonDisabled = false;
$scope.resultMessage = data.message;
$scope.result='bg-danger';
}
});
} else {
$scope.submitButtonDisabled = false;
https://www.programmer.lk/angularjscontactformwithphpmailer/
6/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
contact-form.php
email generate .
PHPMailer library .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**********************************************************
/WWW.PROGRAMMER.LK /
/**********************************************************/
error_reporting(E_ALL);
ini_set('display_errors', '0');
require 'smtp/class.phpmailer.php'; //include phpmailer
https://www.programmer.lk/angularjscontactformwithphpmailer/
7/12
11/20/2016
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
exit;
}
$usermail = $_POST['inputEmail']; //get sender mail address
$sender = $_POST['inputName']; // get sender Name
PROGRAMMER.LK
$mail->AddAddress('RECIPIENT@DOMAIN.COM','YOUR-NAME'
GENERAL
PROGRAMMING / CODING
OTHER
Search
QUESTIONS
the Site...
$mail->Subject = $_POST['inputSubject'];
https://www.programmer.lk/angularjscontactformwithphpmailer/
8/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
if (isset($_POST['ref'])) {
$mail->Body .= "\r\n\r\nRef: " . $_POST['ref'];
}
if(!$mail->Send()) {
$data = array('success' => false, 'message' => 'Message could not be sent. Mailer Error: '
echo json_encode($data);
exit;
} else {
$data = array('success' => true, 'message' => 'Thanks! We have received your message.'
echo json_encode($data);
}
} else {
PROGRAMMER.LK
$data = array('success' => false, 'message' => 'Please
GENERAL
PROGRAMMING / CODING
echo json_encode($data);
OTHER
Search
QUESTIONS
the Site...
}
?>
https://www.programmer.lk/angularjscontactformwithphpmailer/
9/12
11/20/2016
AngularJSContactFormwithPHPMailerPROGRAMMER.LK
AngularJS touch
.
. library functions
. application develop function
.
contact form MVCarchitecture .
index.html page view , app.js model
controllers.js Controller .
Angular .
industry actively . Node.js
.
demo Source files .
DOWNLOAD SOURCE
Share
Share
Tweet
Share
Share
Yasith Gamage
Hi, I'm Ysith, Currently I am working as
PROGRAMMER.LK
HOD in private software firm in Sri Lanka. I
love what i am doing. Thouch with me:
GENERAL
www.yasith.net
PROGRAMMING
/ CODING
OTHER
Search
QUESTIONS
the Site...
Related Posts
https://www.programmer.lk/angularjscontactformwithphpmailer/
10/12