用户在Safari中时未发送PHP电子邮件

时间:2017-01-25 19:15:57

标签: php email safari

所以我有一个表格可以作为我组织的活动的志愿者订阅。一切正常,不适合mac / safari用户。但是当用户在mac ios / osx上并且他/她将在safari上填写表单时,电子邮件永远不会被传递。数据库中填充了用户信息,但确认邮件永远不会到达用户...

我正在使用PHP邮件程序脚本。

这是我的邮件部分的PHP代码:

$subject = 'Bevestiging Vrijwilliger Dollen Dinsdag 2017';

        $message = $surname . ', bedankt voor je aanmelding!<br><br>';
        $message .= 'Om je inschrijving af te ronden vragen we je om deze te bevestigen door op de onderstaande link te drukken.<br><br>';
        $message .= '<a href="http://www.domain.nl/subscribe.php?action=confirm&userId='.$userId.'&userCode='.$confirmationCode.'">http://www.domain.nl/subscribe.php?action=confirm&userId='.$userId.'&userCode='.$confirmationCode.'</a><br>';
        $message .= 'Werkt de link niet door erop te klikken, kopieer en plak deze dan in je browser.<br><br>';
         $message .= 'Klopt deze aanmelding niet? klik dan <a href="http://www.domain.nl/subscribe.php?action=decline&userId=' .$userId. '&userCode=' .$confirmationCode. '">http://www.domain.nl/subscribe.php?action=decline&userId=' .$userId. 'userCode=' .$confirmationCode. '</a> om de aanmelding te annuleren.<br>';
        $message .= 'Werkt de link niet door erop te klikken, kopieer en plak deze dan in je browser.<br><br>';
        $message .= 'Met vriendelijke groet,<br>';
        $message .= 'Stichting Dollen Dinsdag';

        $headers = "Reply-To: Organization <info@domain.nl>".PHP_EOL;
        $headers .= "Return-Path: Dollen Dinsdag <info@dollendinsdag.nl>".PHP_EOL;
        $headers .= "From: organization <info@domain.nl>".PHP_EOL;
        $headers .= "Organization: organization".PHP_EOL;
        $headers .= "MIME-Version: 1.0".PHP_EOL;
        $headers .= "Content-type: text/html; charset=iso-8859-1".PHP_EOL;
        $headers .= "X-Priority: 3".PHP_EOL;
        $headers .= "X-Mailer: PHP". phpversion() .PHP_EOL;

        /////////////////////////

        //$mail->SMTPDebug = 3;                               // Enable verbose debug output

        $mail->isSMTP();                                      // Set mailer to use SMTP
        $mail->Host = 'mail.domain.nl';                  // Specify main and backup SMTP servers
        $mail->SMTPAuth = true;                               // Enable SMTP authentication
        $mail->Username = 'mail@domain.nl';                 // SMTP username
        $mail->Password = 'pass';                           // SMTP password
        $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
        $mail->Port = 25;                                    // TCP port to connect to

        $mail->setFrom('info@dollendinsdag.nl', 'Dollen Dinsdag');
        $mail->addAddress($email);     // Add a recipient
        //$mail->addAddress('ellen@example.com');               // Name is optional
        $mail->addReplyTo('info@dollendinsdag.nl', 'Vrijwilliger');
        //$mail->addCC('cc@example.com');
        //$mail->addBCC('bcc@example.com');

        //$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
        //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
        $mail->isHTML(true);                                  // Set email format to HTML

        $mail->Subject = $subject;
        $mail->Body    = $message;
        $mail->AltBody = $message;

        if(!$mail->send()) {
            echo 'Message could not be sent.';
            echo 'Mailer Error: ' . $mail->ErrorInfo;
        } else {
            echo 'success';
        }

2 个答案:

答案 0 :(得分:0)

听起来InvalidUseOfMatchersException未正确处理。在将变量推送到PHPMailer之前,我会尝试执行以下操作...

$email

答案 1 :(得分:0)

感谢您的回复。似乎某些问题同时出现在一起。我看了一眼我的代码,邮件问题似乎是gmail已将黑名单记入mij帐户...