dongshan6870 2014-03-24 15:32
浏览 25
已采纳

openshift电子邮件从终端发送,但不是从PHP发送

I'm using OpenShift and I have problem sending email.

It works fine when logged in via ssh, for eg:

echo “Test from Postfix” | mail -s “Test1″ me@yahoo.com

However if I want to send an email from php code like this:

if (mail ('me@yahoo.com', "Test Postfix", "Test mail from postfix", "From: somebody@example.com"))
  echo "mail sent succesfully";
else 
  echo "couldn't send mail";

It writes "mail sent succesfully", but no email arrives :( Tried without header too, but it's the same.

Checked the settings for smtp, sendmail_path, sendmail_from and smtp_port, both with php -i and phpinfo(). They are the same:

  • smtp_port=25
  • sendmail_path=(the path that I get with which sendmail)
  • smtp=localhost (also tried with ini_set("SMTP", "smtp.mysmtp.com")).

error.log contains no error. I can't find the email.logs.

Can you suggest some solution?

  • 写回答

4条回答 默认 最新

  • donglingyi4679 2015-01-12 13:24
    关注

    As far as I know, you need a real sender account in order to make it. That's probably why the other answers suggest plugins/libraries. So you need to provide not only a valid SMTP server, but also an account and pass. Agreed however, that it lacks information about the mail not being sent.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误