Rookie question.
I am trying to create a contact form with angularjs and python backend on google app engine. The form so far does send the email, however the Subject and Body fields are not captured in the email. Can someone tell what I am doing wrong?
HTML:
<body ng-app="submitExample">
<form ng-submit="submit()" ng-controller="ExampleController">
<div>
<p>Name</p>
<input ng-model="name" name="name" id="name" rows="1" cols="20"/>
</div>
<div>
<p>Email</p>
<input ng-model="email" name="email" id="email" rows="1" cols="20"/>
</div>
<div><p></p><input type="submit" value="Send Email"></div>
</form>
</body>
angularjs:
angular.module('submitExample',[]).controller('ExampleController', function($scope,$http){
$scope.formData;
$scope.submit = function() {
$http({
method: "post",
url: "/sign",
data: {
name: $scope.name,
email: $scope.email
}
})
}
});
Python:
class SendEmail(webapp2.RequestHandler):
def post(self):
from_address = cgi.escape(self.request.get('email'))
to_address = "[email protected]"
subject = cgi.escape(self.request.get('name'))
body = "xxx"
mail.send_mail(from_address, to_address, subject, body)