Angular Contact表单电子邮件提交问题

时间:2014-12-26 17:05:02

标签: javascript angularjs html5

我创建了一个联系人Click here for example我相信我已创建了此表单所需的所有凭据,但是当我将邮件发送到我的代码中突出显示的电子邮件凭据时,我没有提交电子邮件发件人。有谁知道如何解决这个问题?

angular
.module('hfApp')
.controller('contactCtrl', ['$scope','$http', function($scope, $http) {
    $scope.success = false;
    $scope.error = false;
    $scope.send = function () {
        var htmlBody ='<div>Name: ' + $scope.user.name + '</div>' +
                      '<div>Email: ' + $scope.user.email + '</div>' +
                      '<div>Message: ' + $scope.user.body + '</div>' +
                      '<div>Date: ' + (new Date()).toString() + '</div>';

        $http({
            url: 'http://www.hfpersonaltrainer.com/',
            method: 'POST',
            data: {
                'From': 'foo@foo.com',
                'To': 'nate.tyrone@gmail.com',
                'HtmlBody': htmlBody,
                'Subject': 'New Contact Form Submission'
            },
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'X-Postmark-Server-Token': '8569dcd45-6a1a-4e7b-ae75-ea37629de4'
            }
        }).
        success(function (data) {
            $scope.success = true;
            $scope.user = {};
        }).
        error(function (data) {
            $scope.error = true;
        });
    };
}])

0 个答案:

没有答案