使用PHP向用戶發送電子郵件時遇到問題。我在電子郵件模板中綁定了一些值,但在發送給用戶收件箱的模板中沒有獲取這些值。我在下面解釋我的代碼。使用PHP在電子郵件模板中未獲得價值
$msgSub="Login credentials and verification link for Spesh";
$u_name='Username-"'.$email.'"';
$u_pass='Password-"'.$password.'"';
$url='http://oditek.in/spesh/mobileapi/categoryproduct.php?item=4&acn=2&email='+$email;
ob_start();
include "verification.php";
$msg_body=ob_get_clean();
$is_send=sendMail($email,'[email protected]',$msgSub,$msg_body);
verification.php:
<br /><br />
<b><?php echo $u_name ?></b><br /><br />
<b><?php echo $u_pass ?></b>
<b><?php echo $url ?></b>
<br /><br />
function sendMail($to,$from,$subject,$msg_body){
$headers = "MIME-Version: 1.0" . "\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\n";
$headers .= 'From: '.$from . "\n";
$id=mail($to,$subject,$msg_body,$headers);
if($id){
return 1;
}else{
return 0;
}
}
在這裏我得到價值$u_name and $u_pass
但$url
值來0
。在第一個文件中,我已經聲明瞭url
的值。 url的價值應該來。請幫助我。
請出示此sendmail()函數 –
@ObjectManipulator的內容:我張貼的Sendmail()函數的內容。 – subhra