Javascript 无法使用PHP和Angular.js在电子邮件收件箱中获取电子邮件
我在使用Angular.js和PHP发送电子邮件时遇到一些问题。在这里,我在发送邮件后获得了真实值,但无法在邮箱中获取电子邮件。我的代码如下: sendmail.php:Javascript 无法使用PHP和Angular.js在电子邮件收件箱中获取电子邮件,javascript,php,angularjs,email,Javascript,Php,Angularjs,Email,我在使用Angular.js和PHP发送电子邮件时遇到一些问题。在这里,我在发送邮件后获得了真实值,但无法在邮箱中获取电子邮件。我的代码如下: sendmail.php: require_once("../include/dbconfig.php"); $postdata = file_get_contents("php://input"); $request = json_decode($postdata); $to=$request->to; $url=$request->url
require_once("../include/dbconfig.php");
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$to=$request->to;
$url=$request->url;
$subject=$request->subject;
$msg=$request->message;
$image=$request->image;
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$message='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Medilink Email Section</title>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
Code
</tr>
<p><b><span style="font-family:"Arial","sans-serif"">Thank you for writing to Medilink-Global.</span></b><span style="font-family:"Arial","sans-serif""><br><br>Hi,<br><br>Your E-Voucher code is <b>'.$msg.'</b>.
</tbody>
</table>
</body>
</html>';
$id=mail($to,$subject,$message,$headers);
if($id){
$result["msg"]="Sent successfully";
echo json_encode($result);
}else{
$result["msg"]="Unable to send";
echo json_encode($result);
}
require_once(“../include/dbconfig.php”);
$postdata=文件\u获取\u内容(“php://input");
$request=json_decode($postdata);
$to=$request->to;
$url=$request->url;
$subject=$request->subject;
$msg=$request->message;
$image=$request->image;
$headers=“MIME版本:1.0”。“\r\n”;
$headers.=“内容类型:text/html;字符集=UTF-8”。“\r\n”;
$message='1
Medilink电子邮件部分
代码
感谢您写信给Medilink Global。
您好,
您的电子凭证代码是“$msg”。
';
$id=邮件($to、$subject、$message、$headers);
如果($id){
$result[“msg”]=“发送成功”;
echo json_编码($result);
}否则{
$result[“msg”]=“无法发送”;
echo json_编码($result);
}
我在客户端收到
已成功发送的消息,但此电子邮件无法在我指定的电子邮件地址收件箱中使用。请确保您的主机已启用邮件服务器,并尝试使用smtp连接。您能帮我如何使用smtp连接吗。在这里,您可以找到还能够调试邮件问题的代码