Created
March 12, 2015 22:07
-
-
Save SOLUNTECH/9586a4fba93ed7082306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('App') | |
.controller('HomeCtrl', ['$scope', '$http', '$location', | |
function($scope, $http, $location) { | |
console.log('Init Controller'); | |
$scope.formContact = { | |
'name' : '', | |
'email' : '', | |
'tel' : '', | |
'message' : '' | |
}; | |
$scope.sendEmail = function(){ | |
console.log('Enviar Email'); | |
console.log($scope.formContact); | |
$http.post( | |
"send.php", $scope.formContact | |
).success(function (data) { | |
// if(data._code === 200) { | |
$scope.clearForm(); | |
// alert(data._response); | |
// } | |
}); | |
}; | |
$scope.clearForm = function(){ | |
$scope.formContact.name = ''; | |
$scope.formContact.email = ''; | |
$scope.formContact.tel = ''; | |
$scope.formContact.message = ''; | |
}; | |
/* List of Posts */ | |
// $scope.posts = postService.get(); | |
} | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action=""> | |
<div class="form-group"> | |
<label><input ng-model="formContact.name" type="text" class="form-control" placeholder="Nombre"></label> | |
</div> | |
<div class="form-group"> | |
<label><input ng-model="formContact.email" type="email" class="form-control" placeholder="Email"></label> | |
</div> | |
<div class="form-group"> | |
<label><input ng-model="formContact.tel" type="tel" class="form-control" placeholder="Telefono"></label> | |
</div> | |
<div class="form-group"> | |
<label><textarea ng-model="formContact.message" class="form-control" cols="30" rows="3" placeholder="Mensaje"></textarea></label> | |
</div> | |
<button type="button" ng-click="sendEmail();" class="btn btn-grey pull-right whiteborder">Enviar</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$headers = "From: " . strip_tags('[email protected]') . "\r\n"; | |
$headers .= "MIME-Version: 1.0\r\n"; | |
$headers .= "Content-Type: text/html; charset=UTF-8\r\n"; | |
// $_REQUEST['name'] = "Jonathan Olier"; | |
// $_REQUEST['email'] = "[email protected]"; | |
// $_REQUEST['tel'] = "3177963884"; | |
// $_REQUEST['message'] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur maiores, magnam illo qui, quidem earum accusamus sapiente molestias adipisci vel vero molestiae facilis error provident doloremque eaque quisquam quaerat eligendi."; | |
$table = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"max-width: 600px; margin: auto;\"> | |
<tbody> | |
<tr> | |
<td style=\"padding-bottom: 8px;\"> | |
<table style=\"background-color:#fff;\"> | |
<tbody> | |
<tr> | |
<td style=\"color: #1e80b6; padding-top: 20px; padding-left: 20px; padding-right: 20px;\"> | |
<p> Nombre </p> | |
</td> | |
<td style=\" padding-top: 20px; text-align: right; padding-right: 20px;\"> | |
". $_REQUEST['name'] ." | |
</td> | |
</tr> | |
<tr> | |
<td style=\"color: #1e80b6; padding-left: 20px; padding-right: 20px;\"> | |
<p> Email </p> | |
</td> | |
<td style=\"text-align: right; padding-right: 20px;\"> | |
". $_REQUEST['email'] ." | |
</td> | |
</tr> | |
<tr> | |
<td style=\"color: #1e80b6; padding-bottom: 10px; padding-left: 20px; padding-right: 20px;\"> | |
<p> Telefono </p> | |
</td> | |
<td style=\"text-align: right; padding-right: 20px;\"> | |
". $_REQUEST['tel'] ." | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
<tr> | |
<td style=\"padding-bottom: 8px;\"> | |
<table style=\"background-color:#fff;\"> | |
<tbody> | |
<tr> | |
<td style=\"color: #1e80b6; padding-left: 20px; padding-top: 20px; padding-bottom: 10px;\"> | |
<p> Mensaje </p> | |
</td> | |
</tr> | |
<tr> | |
<td style=\"text-align: left; padding-bottom: 10px; padding-left: 20px; padding-right: 20px;\"> | |
". $_REQUEST['message'] ." | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<table width=\"100%\" border=\"0\" align=\"center\" style=\"color:#353e4a;font-family:Arial,sans-serif;margin:auto;background-color:#ffffff\" cellpadding=\"0\" cellspacing=\"0\"> | |
<tbody> | |
<tr> | |
<td style=\"padding-bottom:15px; padding-top:15px\" align=\"center\"> | |
<table> | |
<tbody> | |
<tr> | |
<td align=\"center\" style=\"background-color:#ef5401;padding:7px;font-family:Arial,sans-serif; max-width: 250px;\"> | |
<a style=\"background-color:#ef5401;font-family:Arial,sans-serif;border:medium none;border-radius:3px;color:white;font-size:21px;min-height:30px;text-decoration:none;padding-top:7px;padding-bottom:7px;padding-left:30px;padding-right:30px\" href=\"http://www.soluntech.com\" target=\"_blank\"> | |
Conocenos | |
</a> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</td> | |
<tr> | |
<td style=\"padding-bottom: 0px;\"> | |
<table width=\"100%\" border=\"0\" align=\"center\" style=\"font-family:Arial,sans-serif;font-size:15px;margin:auto;background-color:#ffffff;color:#353e4a\" cellpadding=\"0\" cellspacing=\"0\"> | |
<tbody> | |
<tr><td style=\"padding-left:25px;padding-right:15px;padding-top:20px\">Att:</td></tr> | |
<tr><td style=\"font-weight:bold;padding-top:10px;padding-bottom:10px;padding-left:25px;padding-right:15px\"><i>El equipo de Soluntech</i></td></tr> | |
<tr><td style=\"height:20px\"> </td></tr> | |
</tbody> | |
</table> | |
</td> | |
</tr> | |
<td style=\"background-color:#ececec\"> | |
<table width=\"100%\" border=\"0\" align=\"center\" style=\"color:#353e4a;font-family:Arial,sans-serif;font-size:14px;margin:auto;padding-bottom:10px\"> | |
<tbody> | |
<tr> | |
<td style=\"color:#717175;font-size:12px;padding-top:10px;padding-bottom:10px\"> | |
Este email se ha generado automáticamente. Por favor, no conteste a este email. | |
Si tiene alguna pregunta o necesita ayuda, por favor haga click en <a href=\" \" style=\"color:#353e4a\" target=\"_blank\">Ayuda</a>. | |
</td> | |
</tr> | |
<tr> | |
<td style=\"color:#717175;font-size:12px;padding-top:10px;padding-bottom:10px\">Si no desea recibir más alertas como esta, por favor, haga click en <a href=\" \" style=\"color:#353e4a\ target=\"_blank\">Baja de alertas</a>.</td> | |
</tr> | |
</tbody> | |
</table> | |
</td> | |
</tbody> | |
</table>"; | |
$html = "<html> | |
<head> | |
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'> | |
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> | |
<style> | |
* { | |
font-family: 'Roboto', sans-serif; | |
outline: none; | |
} | |
td { | |
width: 900px; | |
} | |
</style> | |
</head> | |
<body> | |
<table style=\"background-color:#ececec; width: 100%!important;\"> | |
<tbody> | |
<tr> | |
<td colspan=\"3\" style=\"text-align: center;\"> | |
<img width=\"170\" height=\"131\" src=\"http://www.soluntech.com/_/rsrc/1412805517236/config/customLogo.gif?revision=7\" alt=\"Logo de Soluntech\" /> | |
</td> | |
</tr> | |
<tr> | |
<td>". $table ."</td> | |
</tr> | |
</tbody> | |
</table> | |
</body> | |
</html>"; | |
if(mail('[email protected]', 'Send', $html, $headers)){ | |
echo array('_code' => 200, '_response' => 'Se envio el correo correctamente.'); | |
}else{ // echo 'No se envio el correo'; | |
echo $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment