php email script www-data

Discussion in 'Installation/Configuration' started by cat, Sep 23, 2008.

  1. cat

    cat New Member

    Thanks for a great product, ispconfig is making site management much easer.

    I am writing a php script that sends an email to the user who fills in a form, and a copy of the email to the sales department of the site. When the out ward bound email arrives the Recipient/From looks like [email protected] when it should look like [email protected] and the email that should go to the sales department never arrives.

    I have setup the site with two Co-Domains both with DNS: and DNS MX: ticked

    ip_address www mydomain.com
    ip_address mydomain.com

    I have set up two users
    user1 [email protected]
    user2 [email protected]

    when I view the mail source of the test email the arrives I see (ip addresses changed to protect the innocent).

    From [email protected] Tue, 23 Sep 2008 00:00:51 -0400
    Received: from kumquat.safe-mail.net ([0.0.0.])
    by tamar.safe-mail.net with smlocal (smtas 1.2);
    Tue, 23 Sep 2008 00:01:21 -0400
    DomainKey-Status: not-signed (some+real)
    X-SMTests: g00nmp0i0b0aR00u
    Received: from 0.0.0.0.dynamic.rev.aanet.com.au ([0.0.0.0] helo=mail.myserver.mydomain.com)
    by kumquat.safe-mail.net with esmtp (TLSv1/SSLv3:AES256-SHA:256) (smtpd 1.0)
    id N1K-PWiIWDsmZX
    for [email protected]; Tue, 23 Sep 2008 00:00:51 -0400
    Received-SPF: no-spf
    Received: by mail.myserver.mydomain.com (Postfix, from userid 33)
    id 15929186C0; Tue, 23 Sep 2008 12:01:02 +0800 (WST)
    To: [email protected]
    Subject: Your Quote Request
    MIME-Version: 1.0

    Content-type: text/html; charset=iso-8859-1

    To: [email protected]

    From: [email protected]

    Cc:

    Message-Id: <[email protected]>
    Date: Tue, 23 Sep 2008 12:01:02 +0800 (WST)
     
  2. Ben

    Ben Active Member Moderator

    It's more about how you send your e-mail via php. If you e.g. just use mail() with out any special parameters to set the From, the sender will look like the user sending the e-mail, which in this case is your apache, running as www-data.
    To avoid this, either set the X-From or directly use the pear mail class and directly send it via smtp over the appropriate mailbox.
     
  3. cat

    cat New Member

    email address remapping?

    Thanks for your reply Ben.
    Your response solved the www-data problem.

    However the problem with the internal emails (emails sent to other mail boxes on the same server) persists. Eg no email arrives. This happens whether you send a mail form squirrelmail or a php page, and the error messages are the same.

    Having a look at the mail.log file the lost mail is trying to go to [email protected].

    The host server’s fqdn is hostserver.hostdomain.com the site fqun is mydomain.com

    Any ideas how to fix this problem.

    ###################################
    #
    # ISPConfig virtusertable Configuration File
    # Version 1.0
    #
    ###################################
    [email protected] web1_username
    [email protected] web1_username
    [email protected] web1_username
    [email protected] web1_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_username
    [email protected] web2_sales
    [email protected] web2_sales
    [email protected] web2_sales
    [email protected] web2_sales

    mail.log

    Sep 28 17:13:23 hostserver postfix/smtpd[9057]: connect from localhost[127.0.0.1]
    Sep 28 17:13:23 hostserver postfix/smtpd[9057]: C592F183AB: client=localhost[127.0.0.1]
    Sep 28 17:13:23 hostserver postfix/cleanup[9060]: C592F183AB: message-id=<[email protected]>
    Sep 28 17:13:23 hostserver postfix/qmgr[7164]: C592F183AB: from=<[email protected]>, size=757, nrcpt=1 (queue active)
    Sep 28 17:13:23 hostserver imapd: Connection, ip=[::ffff:127.0.0.1]
    Sep 28 17:13:23 hostserver postfix/smtpd[9057]: disconnect from localhost[127.0.0.1]
    Sep 28 17:13:23 hostserver postfix/smtp[9061]: C592F183AB: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=0.17, delays=0.08/0.09/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=mail.hostserver.hostdomain.com type=AAAA: Host not found)
    Sep 28 17:13:23 hostserver postfix/cleanup[9060]: F10DE186C0: message-id=<[email protected]>
    Sep 28 17:13:24 hostserver postfix/qmgr[7164]: F10DE186C0: from=<>, size=2943, nrcpt=1 (queue active)
    Sep 28 17:13:24 hostserver postfix/bounce[9064]: C592F183AB: sender non-delivery notification: F10DE186C0
    Sep 28 17:13:24 hostserver postfix/qmgr[7164]: C592F183AB: removed
    Sep 28 17:13:24 hostserver postfix/smtp[9061]: F10DE186C0: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=0.04, delays=0.03/0.01/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=mail.hostserver.hostdomain.com type=AAAA: Host not found)
    Sep 28 17:13:24 hostserver postfix/qmgr[7164]: F10DE186C0: removed
    Sep 28 17:13:24 hostserver imapd: LOGIN, user=web2_username, ip=[::ffff:127.0.0.1], port=[57396], protocol=IMAP
    Sep 28 17:13:24 hostserver imapd: LOGOUT, user=web2_username, ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=647, sent=204, time=0
    Sep 28 17:13:24 hostserver imapd: Connection, ip=[::ffff:127.0.0.1]
    Sep 28 17:13:24 hostserver imapd: LOGIN, user=web2_username, ip=[::ffff:127.0.0.1], port=[57397], protocol=IMAP
    Sep 28 17:13:24 hostserver imapd: LOGOUT, user=web2_username, ip=[::ffff:127.0.0.1], headers=524, body=0, rcvd=232, sent=2098, time=0
     
  4. cat

    cat New Member

    problrm solved

    Hi guys,
    After further investigation I descovered that I had entered a mistake during the setup.
    I had put mail.hostserver.hostdomain.com insted of hostserver.hostdomain.com in etc/mailname , now all is working fine.

    thanks for your help

    PS can you please find a way to encourage users to report how they solved there problems so that we can all benefit.
     

Share This Page