Jump to content

[SOLVED] Please help - php mail() function wont work with postfix


samuelodofin

Recommended Posts

Hi,

i have just set up my new server, however i the mail() function on php dosnt work, i have installed postfix and configured the correct send_mail path in the php.ini .......... i just dont know whats wrong..........any help will be very much appreciated.

 

Thanks in advance.

Link to comment
Share on other sites

Do you have postfix running on your server?

Postfix runs on your.ip.of.server:smtp (or port 25).

 

Php uses sendmail by default. Although sendmail can send mail itself, if postfix is already running on port 25, then sendmail uses postfix to send emails.

 

Put your php.ini back to default, i.e. sendmail.

 

Try sending a mail via mail().

 

Check your postifx logs, i.e. /var/log/mail.info or mail.log.

 

Also, does your ISP allow outgoing smtp (25). Test this by going on your server/computer:

telnet mail.skynet.ie 25

 

-steve

Link to comment
Share on other sites

hy steve,

thnx for the reply, i have restored the php.ini back to default and tried the mail() again, but it just wont work ....

i also tested to see if my ISP allows outgoing smtp (25) and it does, got a positive result...but the mail() still not working. do you have any idea of anything else i might be missing.........because i tried sending an email over ssh to myself and it came!...

 

Link to comment
Share on other sites

First off, here is my spiel on sendmail:

http://wiki.kartbuilding.net/index.php/Sendmail

 

Secondly, is this your server? or did your hosting company setup this system? If so, they could have done any number of things to stop php from sending mail. Check for permissions on mail spools and sendmail.

 

You can get a PHP script which will send emails directly!! I.e. open up a socket and sent it all together. This will definately work. There is a good tutorial on phpfreaks for this.

 

Also, check with a phpinfo() where sendmail is. Is it in /usr/bin/sendmail ?

Does this exist on the server?

 

Try the php mail script (you should be able to google it no probs) and see. It'll definately work.

 

-steve

Link to comment
Share on other sites

Hi steve,

thanks for your help, i am usuing postfix instead of sendmail, and i am able to mail myself from /usr/sbin/sendmail.postfix .....works fine.

 

But when i try to run my php script from ssh, it outputted these errors:

 

 

/etc/postfix/main.cf: line 31: queue_directory: command not found

/etc/postfix/main.cf: line 36: command_directory: command not found

/etc/postfix/main.cf: line 42: daemon_directory: command not found

/etc/postfix/main.cf: line 53: mail_owner: command not found

/etc/postfix/main.cf: line 110: inet_interfaces: command not found

/etc/postfix/main.cf: line 155: mydestination: command not found

/etc/postfix/main.cf: line 212: unknown_local_recipient_reject_code: command not found

/etc/postfix/main.cf: line 377: alias_maps: command not found

/etc/postfix/main.cf: line 388: alias_database: command not found

/etc/postfix/main.cf: line 586: debug_peer_level: command not found

/etc/postfix/main.cf: line 604: debugger_command: command not found

/etc/postfix/main.cf: line 606: xxgdb: command not found

/etc/postfix/main.cf: line 634: sendmail_path: command not found

/etc/postfix/main.cf: line 639: newaliases_path: command not found

/etc/postfix/main.cf: line 644: mailq_path: command not found

/etc/postfix/main.cf: line 650: setgid_group: command not found

/etc/postfix/main.cf: line 654: html_directory: command not found

/etc/postfix/main.cf: line 658: manpage_directory: command not found

/etc/postfix/main.cf: line 663: sample_directory: command not found

/etc/postfix/main.cf: line 667: readme_directory: command not found

 

 

I checked and those dirs where there....so..............i duunoo.......

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.