2017-09-13 53 views
-3

我剛上傳我的網站到一個活的服務器,它不再發送電子郵件,網絡主持人希望我使用PHPMAILER。問題是我的代碼在過程接口中,PHPMAILER在OOP中。請幫助我將OOP更改爲程序。如何使用php程序界面實現PHPMAILER?我想發送驗證郵件

$to  = $email; // Send email to our user 
 
$subject = 'Signup | Verification'; // Give the email a subject 
 
$message = ' 
 

 
Thanks for signing up! 
 
Your account has been created, you can login with the following credentials after you have activated your account by copying the url below 
 
and pasting it in your brwoser. 
 

 
------------------------ 
 
Username: '.$email.' 
 
Password: '.$pass.' 
 
------------------------ 
 

 
Please copy and paste this link in the address field and press enter to activate your account:<br> 
 
http://elam.rpaz.co.zw/verify.php?email='.$email.'&password='.$cryptpass.' 
 

 
'; // Our message above including the link 
 

 
$headers = 'From:[email protected]' . "\r\n"; 
 
$mail = new PHPMailer(true); 
 
$mail->IsSMTP(); 
 
$mail->SMTPAuth = true; 
 
$mail->SMTPSecure = "ssl"; 
 
$mail->Host = "mail-2.sslzol.co.zw"; 
 
$mail->Port = 6465; 
 
$mail->Username = '[email protected]'; 
 
$mail->Password = 'rp15kuyuelamhvkyu'; 
 
$mail->Subject = trim("Signup | Verification"); 
 
$mail->SetFrom('[email protected]', 'RPAZ e(LAM)'); 
 
$mail->AddAddress($email); 
 
$mail->MsgHTML($message); 
 

 
try { 
 
    $mail->send(); 
 
} catch (Exception $ex) { 
 
    echo $msg = $ex->getMessage(); 
 
} 
 

 
echo "1 record added"; 
 
mysqli_close($conn); 
 

 
    header("Location: redirect.html"); 
 
    exit; 
 
    }

回答

0

我不能看到這裏的問題如果u需要使用的PHPMailer只是把它你的PHP腳本/頁內。像

不要忘了包括它在開始你的腳本中像

include 'RouteToPHPMailer/PHPMailer'; 

$mail = new PHPMailer(); 

和所有的代碼粘貼ü起來,將工作。

+0

我有一個混合OOP和程序錯誤。請幫助 – leenold

+0

可以分享錯誤plz。 –

+0

致命錯誤:在109行的C:\ wamp64 \ www \ e(LAM)\ reg.php中找不到Class'PHPMailer' – leenold

相關問題