0
使用Angular.js和PHP發送電子郵件時遇到一些問題。在發送郵件後,我獲得了真正的價值,但是我無法在郵箱。我在下面解釋我的代碼。無法使用PHP和Angular.js在電子郵件收件箱中獲取電子郵件
sendEmail.php:
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);
}
在這裏我得到的客戶端Sent successfully
消息,但此郵件不能在我給出的郵件地址,inbox.Please幫我解決這個問題。
你能幫我如何使用smtp連接。 – satya
https://github.com/PHPMailer/PHPMailer在這裏你可以找到代碼也能夠調試郵件問題 –