Sendmail Query - PHP script

Discussion in 'Server Operation' started by tech_paul, Sep 1, 2009.

  1. tech_paul

    tech_paul New Member

    Hi,

    Scenario:

    I have 2 servers, 1 webserver (incl. dns) and 1 mail server in the same network. In the webserver there is a PHP script that is sending e-mails (to an account on the mail server) but is sending them locally on the webserver and not to the mailbox on the mail server. The webserver is like, it does not know that it should NOT handle emails for that domain, but route it to the mail server (where the mailbox is).

    If I set an external account (gmail etc..) that is not hosted on the webserver, it works fine. The problem is when I set the php script to send to an account from my mail server.

    What can I set on the web server in order to route emails to the mail server please? Can this problem be solved please?

    ANY HELP APPRECIATED!! Thanks in advanced
     
  2. id10t

    id10t Member

    mx record, local domains, etc. will depend on what SMTP server you have on the webserver...
     
  3. tech_paul

    tech_paul New Member

    Can you please elaborate what I need to do? I have mx records on the webserver that eventually they point to the mail server.

    What do you mean by "depend on what SMTP server"? I have sendmail as an SMTP server.

    Thanks for your reply
     
  4. id10t

    id10t Member

    There may be something in the sendmail config on the webserver that tells it to deliver mail for your domain to users on that host, as opposed to sending it out to your real mail server...
     
  5. tech_paul

    tech_paul New Member

    Thanks very much for your reply.

    I have tried to set it as you told me but than no emails can be sent! Do I need to setup something on the mail server to accept the webserver to use its smtp pls?
     
  6. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    ls -la /etc/mail/
    ?
     
  7. tech_paul

    tech_paul New Member

    Hi Falko,

    Please find the command ls -la /etc/mail on the webserver:

    > ls -la /etc/mail/
    total 360
    drwxr-xr-x 3 root root 4096 Sep 3 09:04 .
    drwxr-xr-x 104 root root 12288 Sep 4 04:05 ..
    -rw-r--r-- 1 root root 1048 Mar 15 2007 Makefile
    -rw-r--r-- 1 root root 355 Mar 15 2007 access
    -rw-r----- 1 root root 12288 Sep 2 07:11 access.db
    -rw-r--r-- 1 root root 0 Mar 15 2007 domaintable
    -rw-r----- 1 root root 12288 Sep 2 07:11 domaintable.db
    -rw-r--r-- 1 root root 5521 Mar 15 2007 helpfile
    -rw-r--r-- 1 root root 64 Mar 15 2007 local-host-names
    -rw-r--r-- 1 root root 32 Sep 1 14:36 local-host-names.rpmsave
    -rw-r--r-- 1 root root 0 Mar 15 2007 mailertable
    -rw-r----- 1 root root 12288 Sep 2 07:11 mailertable.db
    -rw-r--r-- 1 root root 50 Sep 1 18:52 mailertable.rpmsave
    -rw-r--r-- 1 root root 415 Sep 1 13:24 relay-domains
    -rw-r--r-- 1 root root 58292 Sep 3 09:04 sendmail.cf
    -rw-r--r-- 1 root root 58194 Sep 2 08:40 sendmail.cf.orig
    -rw-r--r-- 1 root root 58284 Sep 1 18:49 sendmail.cf.rpmsave
    -rw-r--r-- 1 root root 7198 Sep 3 07:59 sendmail.mc
    -rw-r--r-- 1 root root 7227 Sep 1 18:49 sendmail.mc.rpmsave
    drwxr-xr-x 2 root root 4096 Jul 17 16:53 spamassassin
    -r--r--r-- 1 root root 41275 Mar 15 2007 submit.cf
    -rw-r--r-- 1 root root 940 Mar 15 2007 submit.mc
    -rw-r--r-- 1 root root 127 Mar 15 2007 trusted-users
    -rw-r--r-- 1 root root 0 Mar 15 2007 virtusertable
    -rw-r----- 1 root root 12288 Sep 2 07:11 virtusertable.db

    Do you need the result of this command on the mail server?

    Regards,

    Paul
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Is the domain listed in /etc/mail/local-host-names? If so, remove it and restart Sendmail.
     
  9. tech_paul

    tech_paul New Member

    Hi Folko,

    That file is empty so there are no domains in this file. I have read something that I need to do the sendmail on the webserver to relay through the sendmail on the mail server.

    Have you ever done this please? Or do you have any other suggestions?

    Thanks for your help

    Paul
     
  10. falko

    falko Super Moderator Howtoforge Staff

    I've done this with Postfix, but not Sendmail...
     
  11. tech_paul

    tech_paul New Member

    Hi Folko,

    If you can tell me which main parts I need to configuring on postfix and how, maybe I can adopt it to sendmail. I will try to find similar config. I believe they are very similar right?

    Paul
     
  12. falko

    falko Super Moderator Howtoforge Staff

    No, unfortunately you can't compare Sendmail and Postfix configuration - they are very different (and Sendmail is a nightmare to configure...).
     

Share This Page