【问题标题】:Contact form 7 not getting email联系表格 7 收不到电子邮件
【发布时间】:2019-07-26 13:29:16
【问题描述】:

我正在使用联系表 7,但遇到此电子邮件 ID 的问题,我没有收到任何邮件,我们可以为此做些什么。我也使用了 SMTP。 你能建议我任何其他选择吗?

【问题讨论】:

    标签: wordpress email contact-form-7


    【解决方案1】:

    最好的选择是在 php 中使用 PhpMailer 库。您可以使用 php mailer 检查电子邮件是否发送成功。您需要做的就是获取所有库代码并将其添加到您的 FTP 或使用 composer 安装它。

    这是一个简单的例子。

    <?php
    // Import PHPMailer classes into the global namespace
    // These must be at the top of your script, not inside a function
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
    
    // Load Composer's autoloader
    require 'vendor/autoload.php';
    
    // Instantiation and passing `true` enables exceptions
    $mail = new PHPMailer(true);
    
    try {
        //Server settings
        $mail->SMTPDebug = 2;                                       // Enable verbose debug output
        $mail->isSMTP();                                            // Set mailer to use SMTP
        $mail->Host       = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
        $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
        $mail->Username   = 'user@example.com';                     // SMTP username
        $mail->Password   = 'secret';                               // SMTP password
        $mail->SMTPSecure = 'tls';                                  // Enable TLS encryption, `ssl` also accepted
        $mail->Port       = 587;                                    // TCP port to connect to
    
        //Recipients
        $mail->setFrom('from@example.com', 'Mailer');
        $mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
        $mail->addAddress('ellen@example.com');               // Name is optional
        $mail->addReplyTo('info@example.com', 'Information');
        $mail->addCC('cc@example.com');
        $mail->addBCC('bcc@example.com');
    
        // Attachments
        $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
        $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
    
        // Content
        $mail->isHTML(true);                                  // Set email format to HTML
        $mail->Subject = 'Here is the subject';
        $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
    
        $mail->send();
        echo 'Message has been sent';
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
    }
    

    您可以在这里Php Mailer On Github获取有关 PhpMailer 的所有信息

    PhpMailer 配置良好,因此您不必担心您的电子邮件最终会进入垃圾邮件文件夹。还要注意定期发送给单个收件人的邮件数量。

    【讨论】:

      【解决方案2】:

      您检查过垃圾邮件文件夹吗?也许电子邮件在垃圾邮件中,因为电子邮件不在垃圾邮件中,您可以使用https://wordpress.org/plugins/wp-mail-smtp/

      这里是设置文档https://wpforms.com/docs/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/

      请检查可能对您有帮助。

      【讨论】:

      • 我已经使用了那个邮件 SMTP 插件。以及根据您提供的链接,我遵循了该链接,但没有得到任何结果。请你告诉我它非常重要,
      • 您检查过电子邮件更改吗?联系表格 7 设置中的邮件选项卡是否有任何错误?请查看此链接contactform7.com/setting-up-mail
      • 是的,我也更改了电子邮件并且没有收到任何错误消息,基本上,该表单已正确提交,但该数据未在我的邮件 ID 上。
      • 可能是发送的电子邮件在接收者端获得了如此高的垃圾邮件分数(出于某种原因),甚至没有进入垃圾邮件文件夹。尝试在isnotspam.com 或任何类似服务上生成电子邮件地址以检查垃圾邮件评级。
      • Hiiiii 基本上我查看了我的联系表 7 插件,我认为它不起作用。这就是为什么我实际上又创建了一个新表单并尝试了但该表单也不起作用。所以我们可以在不卸载的情况下做什么。
      猜你喜欢
      • 2015-09-16
      • 1970-01-01
      • 1970-01-01
      • 2017-02-18
      • 2015-10-11
      • 1970-01-01
      • 1970-01-01
      • 2017-05-27
      • 2017-10-19
      相关资源
      最近更新 更多