2014-09-01 38 views
0

我有一個非常奇怪的問題,經過長時間的谷歌搜索後,我找不到任何類似的問題。PHPMailer從world4you FTP帳戶發送第二封郵件

我在我的網站上有註冊表單,並通過提交表單確認郵件發送給用戶。在網站上線之前,一切都很完美。由於我將我的網站放在了world4you服務器上,因此我收到了兩封確認郵件。 一個是原始的一切,一切都格式化,第二個顯然是從FTP服務器。 發件人是:[email protected]。 ftpxxxxxx是我ftp賬號的用戶名。

這裏是PHPMailer的代碼:

$mail = new PHPMailer; 
$mail->isSMTP();          // Set mailer to use SMTP 
$mail->Host = 'smtp.world4you.com';      // Specify main and backup SMTP servers 
$mail->SMTPDebug = 0; 
$mail->SMTPAuth = true;         // Enable SMTP authentication 
$mail->Sender = '[email protected]'; 
$mail->Username = '[email protected]'; // SMTP username 
$mail->Password = 'xxxxxxxx';        // SMTP password 
$mail->SMTPSecure = 'tls';        // Enable encryption, 'ssl' also accepted 
$mail->Port = 587; 
$mail->SetFrom('[email protected]'); 
$mail->From = '[email protected]'; 
$mail->FromName = 'BarCamp Zukunftsdialog'; 
$mail->addAddress($_POST['email']);      // Add a recipient 

$mail->WordWrap = 50;         // Set word wrap to 50 characters 
$mail->isHTML(true); 
$mail->CharSet = 'utf-8';        // Set email format to HTML        

$mail->Subject = 'Here is the subject'; 
$mail->Body = 'Here is the body'; 

if(!$mail->send()) { 
    echo 'Message could not be sent.'; 
    echo 'Mailer Error: ' . $mail->ErrorInfo; 
} 
else { 
    echo "<div class='alert alert-success' role='alert'>Sie haben sich erfolgreich angemeldet!</div>"; 
} 

mail($_POST['email'], $mail->Subject, $mail->Body); 
         } 
else { 
    echo "<div class='alert alert-danger' role='alert'>Bitte füllen Sie alle Felder aus, welche mit * markiert sind!</div>";  
} 

我希望有人能找到這個問題。

在此先感謝!

+0

你'$ MAIL->發送()'然後'郵件(...)'。看起來像一個或另一個是多餘的。 – tripleee 2014-09-01 14:47:22

+0

最後還有一個懸掛'else'塊。 – tripleee 2014-09-01 14:48:47

回答

1

您需要刪除這一行:

mail($_POST['email'], $mail->Subject, $mail->Body); 

電子郵件已經由以下檢查發送:

if(!$mail->send()) { 
+0

它工作:) thnx很多!!!! – 2014-09-01 14:39:10

相關問題