PHPMailer从world4you FTP帐户发送第二封邮件

时间:2014-09-01 14:35:34

标签: email phpmailer

我有一个非常奇怪的问题,经过漫长的谷歌搜索,我找不到任何类似的问题。

我在我的网站上有一份注册表格,并且通过提交表格,正在向用户发送确认邮件。在将网站放到网上之前,一切都很完美。由于我将我的网站放在world4you服务器上,我收到了两封确认邮件。 一个是原始的,其中一切都是完美的格式,第二个显然来自FTP服务器。 发件人是:ftpxxxxxx@www94.world4you.com。 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 = 'office@barcamp-zukunftsdialog.at';
$mail->Username = 'office@barcamp-zukunftsdialog.at';   // SMTP username
$mail->Password = 'xxxxxxxx';                               // SMTP password
$mail->SMTPSecure = 'tls';                              // Enable encryption, 'ssl' also accepted
$mail->Port = 587; 
$mail->SetFrom('office@barcamp-zukunftsdialog.at');
$mail->From = 'office@barcamp-zukunftsdialog.at';
$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>";       
}

我希望有人能找到问题。

提前致谢!

1 个答案:

答案 0 :(得分:1)

您需要删除此行:

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

电子邮件已通过以下检查发送:

if(!$mail->send()) {
相关问题