使用Microsoft电子邮件帐户(如Live或Office 365)的客户端未收到使用以下代码发送的警报电子邮件。短信功能以及Yahoo和Gmail的工作原理。在计算机上运行链接,提示要共享的位置和电子邮件&要发送的文字。
用于发送电子邮件的电子邮件是通过Office 365.任何人都可以看一下。我错过了什么吗?
我尝试过使用PHP Mailer,但它完全相同。任何帮助!
<html>
<head>
<title>Redirecting</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<?php
setcookie("tracker", 1, time()+1800);
$queryString = $_SERVER['QUERY_STRING'];
//$stripped = substr($queryString,strpos($queryString,"i")+1)
$count=-6;
$id=substr($queryString,$count,6);
//start email alert
//connect to database
//db connection
$db = new mysqli('localhost', 'smart', 'smart', 'smarter');
if (mysqli_connect_errno()) {
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
// associate carrier with correct ending
$query = "SELECT * FROM `smarter` where id = '$id'";
$result = $db->query($query);
$row = $result->fetch_assoc();
$email = $row['email'];
$emailSMS = $row['emailSMS'];
$ownername = $row['ownername'];
$txt_alert = $row['txt_alert'];
$number = $row['phoneone'] . $row['phonetwo'] . $row['phonethree'] . $row['carrier']; // var works
$emailSMS = 1;
if ($txt_alert == "yes")
{
$email_to = $email . " , " . $number;
}
else if ($txt_alert == "no")
{
$email_to = $email;
}
//check to see if tag has been registered
if ($_COOKIE["tracker"] == 1) {
$number = $row['phoneone'] . $row['phonetwo'] . $row['phonethree'] . $row['carrier']; // var works
//check to see if tag has been registered
$host = "smtp.office365.com";
$port = "587";
$username = "support@xxxx.com";
$password = "xxxxxx";
$datetime = date("D M j G:i:s T Y");
$subject = "Alert";
$mailheader.= "From: " . "Smart Recovery Tag Team <support@xxxx.com>\n";
$mailheader.= "X-Sender: " . "support@xxxx.com\n";
$mailheader.= "Return-Path: " . "support@xxxx.com\n";
$mailheader .= "Bcc: support@xxxx.com";
$body .= "Dear " . $ownername . ", \n\n";
$body .= "Your tag has just been scanned.\n\n";
$body .= "Click here to Login to your profile\n";
$body .= "http://www.tag.com\n";
$body .= "***************\n";
$body .= " Login to your profile to see a map of the last GPS location. \n\n";
$body .= "Scanned on " . $datetime . ". \n\n";
$body .= "Regards,";
$body .= " \n\n";
$body .= "Tag Team";
$body .= " \n\n";
$body .= "Keeping found";
if ($txt_alert == "yes")
{
mail($email, $subject, $body, $mailheader, ) or die ("Mail could not be sent.");
mail($number, $subject, $body, $mailheader, ) or die ("Mail could not be sent.");
}
else if ($txt_alert == "no")
{
mail($email, $subject, $body, $mailheader ) or die ("Mail could not be sent.");
}
//send email
$_COOKIE["tracker"] = 0;
}
header("Location: http://www.smartrecoverytag.com/profile.php?id=$id");
mysql_close($db);
?>
</body>
</html>