<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers: Content-Type');
//Include Files
include 'config.php';
include 'jsonFormat.php';
include 'jsonDeliver.php';
$josn = file_get_contents("php://input");
$data = json_decode($josn, true);
$jsonresponse = array();
$Email=$data['signUp'][0]['email'];
echo $Email;
$to=$Email;
$subject='Email verification';
$address = $to;
$from='noreply@example.com';
$body='hi';
function Send_Mail($to,$subject,$body,$from)
{
require_once('./smtp/class.phpmailer.php');
//$from = "from@gmail.com";
$mail = new PHPMailer();
$mail->IsSMTP(); // use SMTP
$mail->IsHTML(true);
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = 'smtp.zoho.com'; // Amazon SES server, note "tls://" protocol
$mail->Port = 465; // set the SMTP port
$mail->Username = 'noreply@example.com'; // SMTP username
$mail->Password = 'noreply@123'; // SMTP password
$mail->SetFrom('noreply@example.com');
$mail->AddReplyTo('noreply@example.com');
$mail->Subject = $subject;
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address,$to);
if(!$mail->Send())
{
//"Mailer Error". $mail->ErrorInfo;
echo "Mailer Error". $mail->ErrorInfo;
}
else
{ $msg="your account activation link has sent to your mail please activate your account by clicking on givrn link";
echo $msg;
}
}
Send_Mail($to,$subject,$body,$from);
?>
我试图将邮件从php发送到特定的输入邮件ID,但因为显示网络错误而卡住了。我尝试了很多方法来解决这个问题但却找不到。请帮我解决这个问题。这是服务器问题吗?