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 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号