0

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?

katalins
  • 3
  • 2

4 Answers4

1

I would recommmed checking out the following StackOverflow question: Can't send email through openshift

It sorted everything out for me, and you can define all the variables using the PHPMailer. I spent a few hours trying to do what you were trying to do with PHP within Openshift, but found this plugin solved it almost immediately.

Community
  • 1
  • 1
danieljimeneznz
  • 449
  • 6
  • 12
0

Could be getting caught in the outgoing spam filter, depending on the content etc.

0

The plugin WP Mail SMTP was a solution for me. Read the howtos here: http://www.wpbeginner.com/plugins/how-to-send-email-in-wordpress-using-the-gmail-smtp-server/

katalins
  • 3
  • 2
0

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.

ptrk
  • 1,800
  • 1
  • 15
  • 24