Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Created March 27, 2017 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/6298b0f37b768ebbfcd7904b5baeb8fa to your computer and use it in GitHub Desktop.
Save itswadesh/6298b0f37b768ebbfcd7904b5baeb8fa to your computer and use it in GitHub Desktop.
'use strict';
angular.module('sendmailApp', [])
.controller('MailController', function ($scope,$http) {
$scope.loading = false;
$scope.mail = {to: 'support@codenx.com'};
$scope.send = function (mail){
$scope.loading = true;
$http.post('api/index.php', { to: mail.to }).then(res=>{
$scope.loading = false;
if(res.status===200)
$scope.serverMessage = 'Email sent with attachment';
else
$scope.serverMessage = 'Error sending email';
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment