【问题标题】:Swiftmailer does not send from Hyper-V virtual machineSwiftmailer 不从 Hyper-V 虚拟机发送
【发布时间】:2019-12-11 15:44:03
【问题描述】:

一台装有 Ubuntu 18 的 Hyper-V 机器有一个带有 SwiftMailer 的 Symfony 4.3 应用程序。尝试使用php bin/console swiftmailer:email:send 从命令行发送电子邮件会导致

[OK] 1 封电子邮件已成功发送。

虽然 mail.log 包含这个

localhost sm-mta[5847]: xBBFThub005847: localhost [127.0.0.1] 没有 在连接到 MTA-v4 期间发出 MAIL/EXPN/VRFY/ETRN

而且这封电子邮件从未收到。

.env.local 包含

MAILER_URL=gmail://username@gmail.com:password@localhost?encryption=tls&auth_mode=oauth

.../config/packages/swiftmailer.yaml:

swiftmailer:
    default_mailer: memory
    mailers:
        memory:
            sender_address: 'admin@bogus.info'
            transport:        smtp
            spool: { type: 'memory' }
        spooler:
                sender_address: 'admin@bogus.info'
                transport:        smtp
                spool:
                    type: file
                    path: '%kernel.project_dir%/var/spool'

使用来自主机的相同配置确实可以传递邮件。

【问题讨论】:

    标签: symfony swiftmailer hyper-v


    【解决方案1】:

    虽然最终的解决方案可能过度,但它是有效的。我首先尝试安装 sendmail,但没有成功。清除它并在this tutorial 之后安装后缀,以使用后缀中继到 gmail。当测试消息失败时,我按照 kjones 在this site 提供的答案。 gmail 允许“访问安全性较低的应用设置”,现在一切正常。

    所有这些都是为了练习上线!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多