【问题标题】:How i can configurate Msmtp to work with gmail SMTP我如何配置 Msmtp 以使用 gmail SMTP
【发布时间】:2014-03-17 12:54:17
【问题描述】:

我尝试在服务器上安装一个与 Gmail SMTP 配合使用的 msmtp。

我的 .msmtprc 文件:

defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account default
host smtp.gmail.com
port 587
auth on
user thetranslationtrustee@linguacustodia.com
password XXXXXX
from thetranslationtrustee@linguacustodia.com
logfile /var/log/msmtp.log

我的 php.ini 文件有这一行:

sendmail_path = /usr/bin/msmtp  -C /root/.msmtprc -t

命令:

msmtp arnaud.gicquel@linguacustodia.com
test
test
test
test

完美工作并发送邮件

但是

>cat test_mail.php
 <?php
        if ( mail ( 'arnaud.gicquel@linguacustodia.com', 'Test mail from localhost', 'Working Fine.' ) ){
        echo 'Mail sent ';
        }

        else{
        echo 'Error. Please check error log.';
        }

?>
>php test_mail.php
Mail sent 

似乎可以工作,但我从来没有收到邮件

任何人都可以帮我配置 Msmtp 以使用 Gmail 作为 SMTP 中继

【问题讨论】:

  • 我不明白为什么来自linguacustodia.com 的电子邮件会被gmail smtp 处理,我遗漏了一些明显的东西?
  • linguacustodia 是我们的专业 gmail 帐户,它是 google 应用的

标签: php linux email debian msmtp


【解决方案1】:

我已经解决了这个问题。就是 /root/.msmtprc 具有不可访问的权限,必须是 600 和所有者 www-data

【讨论】:

    【解决方案2】:

    我输入

    sendmail_path = /usr/bin/msmtp -t

    (没有参数-C)

    进入 php.ini 文件。

    然后

    mail ($to, $subject, $body, $from)
    

    有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      • 1970-01-01
      • 1970-01-01
      • 2014-11-10
      • 2012-02-14
      相关资源
      最近更新 更多