-1
如果我使用Gmail smtp憑證正常工作,並且上線後服務器無法正常工作。當我使用godaddy網絡郵件時,它不適用於本地主機或活動服務器。使用PHPmailer發送郵件不適用於實時服務器
這是我的PHP文件。
<?php
$data = json_decode(file_get_contents("php://input"));
$Cust_Email = $data->Cust_Email;
$result = array();
require 'vendor/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'relay-hosting.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = '******';
$mail->SMTPSecure = 'ssl';
$mail->Port = 25;
$mail->setFrom('[email protected]', 'Admin');
$mail->addAddress($Cust_Email);
$mail->isHTML(true);
$mail->Subject = 'Welcome To User.';
$mail->Body = 'This is greating from Admin';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
$result = '_FAIL';
} else {
$result = '_SUCCESS';
}
echo json_encode($result);
?>
使用此代碼並獲取調試數據,並讀取您的代碼或您的託管$ mail-> SMTPDebug = 2; –