Find the answer to your Linux question:
Results 1 to 6 of 6
I am transfering a php built website from a webhoster to our own webserver. Apache and PHP aren't a real problem, except for the mail() command in PHP. The server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Enthusiast
    Join Date
    Oct 2004
    Posts
    609

    Apache + PHP + Sendmail?


    I am transfering a php built website from a webhoster to our own webserver.

    Apache and PHP aren't a real problem, except for the mail() command in PHP.
    The server is not required to act as a mailserver for the domains hosted on it. Only some PHP forms need to send their info externally using the mail() command.

    This I don't seem to be able to achieve
    And since the originating server is a Windows machine, there is nothing to peek at.

    Anybody care to help me on my way with this? The PHP forms do not generate any kind of error.

    Relevant section of php.ini:
    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = anything@foobar.com

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    sendmail_path = /usr/sbin/sendmail -t -i
    Relevant piece of sendmail.mc:
    dnl # The following causes sendmail to only listen on the IPv4 loopback address
    dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
    dnl # address restriction to accept email from the internet or intranet.
    dnl #
    DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

  2. #2
    Linux Enthusiast
    Join Date
    Oct 2004
    Posts
    609
    I have looked at the mail logfile and found out messages are going out:

    Oct 25 08:26:43 antarctica sendmail[3534]: l9P6Qhpl003534: from=root, size=49, class=0, nrcpts=1, msgid=<200710250626.l9P6Qhpl003534@localhost.local domain>, relay=root@localhost

    Oct 25 08:26:43 antarctica sendmail[3535]: l9P6QhQD003535: from=<root@localhost.localdomain>, size=354, class=0, nrcpts=1, msgid=<200710250626.l9P6Qhpl003534@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

    Oct 25 08:26:43 antarctica sendmail[3534]: l9P6Qhpl003534: to=working-address@provider.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30049, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9P6QhQD003535 Message accepted for delivery)

    Oct 25 08:27:04 antarctica sendmail[3537]: l9P6QhQD003535: to=<working-address@provider.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:21, xdelay=00:00:21, mailer=esmtp, pri=120354, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.

    Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: Authentication-Warning: localhost.localdomain: apache set sender to working-address@other-provider.com using -f

    Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: from=working-address@other-provider.com, size=194, class=0, nrcpts=1, msgid=<200710250637.l9P6bqrx003730@localhost.local domain>, relay=apache@localhost

    Oct 25 08:37:52 antarctica sendmail[3731]: l9P6bqAq003731: from=<working-address@other-provider.com>, size=533, class=0, nrcpts=1, msgid=<200710250637.l9P6bqrx003730@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

    Oct 25 08:37:52 antarctica sendmail[3730]: l9P6bqrx003730: to=working-address@provider.com, ctladdr=working-address@other-provider.com (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30194, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9P6bqAq003731 Message accepted for delivery)

    Oct 25 08:38:14 antarctica sendmail[3733]: l9P6bqAq003731: to=<working-address@provider.com>, delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120533, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
    Based on this, I assume php/apache is configured properly (since the mails go out), but do I need to tweak sendmail ?!?

    Any advice welcome of course!

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,769
    Are you able to send a mail using
    mail command ,try this and post ur output.

    #mail -iInv -s "subject" lakshmipathi.g@gmail.com
    Hi this is test mail.
    ctrl + D


    what's the output now?
    what the mail log says?
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast
    Join Date
    Oct 2004
    Posts
    609
    After I hit [CTRL][D] I got the following:

    EOT
    lakshmipathi.g@gmail.com... Connecting to [127.0.0.1] via relay...
    220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Thu, 25 Oct 2007 15:10:37 +0200
    >>> EHLO localhost.localdomain
    250-localhost.localdomain Hello antarctica [127.0.0.1], pleased to meet you
    250-ENHANCEDSTATUSCODES
    250-PIPELINING
    250-8BITMIME
    250-SIZE
    250-DSN
    250-ETRN
    250-DELIVERBY
    250 HELP
    >>> MAIL From:<polarbear@localhost.localdomain> SIZE=138
    250 2.1.0 <polarbear@localhost.localdomain>... Sender ok
    >>> RCPT To:<lakshmipathi.g@gmail.com>
    >>> DATA
    250 2.1.5 <lakshmipathi.g@gmail.com>... Recipient ok
    354 Enter mail, end with "." on a line by itself
    >>> .
    250 2.0.0 l9PDAbwH004487 Message accepted for delivery
    lakshmipathi.g@gmail.com... Sent (l9PDAbwH004487 Message accepted for delivery)
    Closing connection to [127.0.0.1]
    >>> QUIT
    221 2.0.0 localhost.localdomain closing connection
    Here is the info from the logfile:

    Oct 25 15:10:37 antarctica sendmail[4486]: l9PDAa0l004486: from=polarbear, size=138, class=0, nrcpts=1, msgid=<200710251310.l9PDAa0l004486@localhost.local domain>, relay=polarbear@localhost

    Oct 25 15:10:37 antarctica sendmail[4487]: l9PDAbwH004487: from=<polarbear@localhost.localdomain>, size=452, class=0, nrcpts=1, msgid=<200710251310.l9PDAa0l004486@localhost.local domain>, proto=ESMTP, daemon=MTA, relay=antarctica [127.0.0.1]

    Oct 25 15:10:37 antarctica sendmail[4486]: l9PDAa0l004486: to=lakshmipathi.g@gmail.com, ctladdr=polarbear (500/500), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30138, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l9PDAbwH004487 Message accepted for delivery)

    Oct 25 15:10:59 antarctica sendmail[4489]: l9PDAbwH004487: to=<lakshmipathi.g@gmail.com>, ctladdr=<polarbear@localhost.localdomain> (500/500), delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120452, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
    Seems the same result
    Last edited by Redman; 10-25-2007 at 03:07 PM. Reason: mail log info added

  6. #5
    Linux Enthusiast
    Join Date
    Oct 2004
    Posts
    609
    I tried the same on a mailbox at work and there I did get mail

    Van: SysAdmin [polarbear@localhost.localdomain]
    Verzonden: donderdag 25 oktober 2007 15:43
    Aan: Redman (company)
    Onderwerp: webserver

    **TEST**

  7. #6
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,769
    Code:
    Oct 25 15:10:59 antarctica sendmail[4489]: l9PDAbwH004487: to=<lakshmipathi.g@gmail.com>, ctladdr=<polarbear@localhost.localdomain> (500/500), delay=00:00:22, xdelay=00:00:22, mailer=esmtp, pri=120452, relay=gsmtp163.google.com. [64.233.163.27], dsn=4.0.0, stat=Deferred: Connection reset by gsmtp163.google.com.
    If I'm right,i think your mail reaches google but google not accepts your mail because ,
    google doesn't recognice the from domain. ie. from address.

    you can send mail from work station because your workstation as valid Exchange server i guess.
    try commands , like
    dig yourhostname
    from home and office

    it'll provide atleast 1 answer
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -----
    FOSS India Award winning ext3fs Undelete tool www.giis.co.in. Online Linux Terminal http://www.webminal.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •