0

I am trying to send email from php here are my configuration and code :

 smtp_port = 25
 SMTP = 'my ip address'

mail('[email protected]', 'subject', 'message', 'FROM : headerInfo');

I do not know what I am missing this is not sending emails.

Edit :

I am not getting error .. $result = mail(); echo $result; is printing nothing.

No messages in spam.

Server is not local host the files are on remote server but i don't know if it is a SMTP server or not.

How can I UN-block ISP?

I checked the log :

fatal: bind 0.0.0.0 port 25: Address already in use

how can i fix it?

3
  • Are you running a mailserver on the specified smtp location? Do you get any errors? We'll need a bit more than that to work with. Commented May 30, 2013 at 7:25
  • Check the spam box, sometimes if the smtp server is not recognized by outer server the emails are pushed to the spam box ;) Commented May 30, 2013 at 7:25
  • You are right, PHP is not able to send e-mails... You need a SMTP server... Commented May 30, 2013 at 7:28

3 Answers 3

1

You are using default php.ini settings to send emails. It might be:

  • you don't have a mail server (if you are running on localhost or that IP address doesn't have a mail server)
  • port 25 is blocked by your ISP (you can ask to unblock it)
Sign up to request clarification or add additional context in comments.

Comments

0

If all is going well than you must check your smtp once again and check your php mail page. It must be uploaded on server not on your localhost system.

Comments

0
  1. First check if the sendmail_path variable is set properly. You can see it from echo phpinfo() in a page. The typical value is /usr/sbin/sendmail -t -i

  2. If you are sending extra headers in the 4th parameter of the function, try to remove it and send. It is a very common scenario to have incorrect header in the mail function. Check if you have a spam filter installed in your server which is blocking your email.

  3. If you have access check your mail log file to see if the email is blocked by the mail server or have not reached the server yet. If there is no entry of your email in the log, it means you have problem in your php code or php configuration. If it is in the log, you can see why it was not delivered. The typical path to mail log file is /var/log/maillog

  4. Check if you are running on localhost or that IP address doesn't have a mail server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.