我想使用AngularJS 1和PHP发送包含文件内容(default_message.php)的电子邮件。
前端 - AngularJS和HTML5 - default_message.php
<div ng-app="emailApp" ng-controller="MainController as Main">
Dear {{Main.user}},
I am sending you this email !!
</div>
<script>
angular.module("emailApp",[])
.controller("MainController", function(){
var vm = this;
vm.user = "Vlad";
});
</script>
后端 - PHP
<?php
$template = readfile("default_message.php"); // not compiled
$to = "user@yahoo.com";
$subject = "Hello";
$body = $template;
$from = "Sender";
mail($to,$subject,$body,$from);
?>
如何首先渲染角度,然后读取文件以便我可以发送邮件?
我应该创建一个存储我的数据的网络服务(在这种情况下:用户),然后将其显示为PHP变量(亲爱的 $ user_from_service )?
任何提示我应该怎么做才会很好,谢谢!!