Can't connect to SQL server(Virtual Users And Domains With Postfix, Courier, MySQL)

Discussion in 'HOWTO-Related Questions' started by Naeh, Dec 23, 2006.

  1. Naeh

    Naeh New Member

    Address family not supported (Virtual Users And Domains With Postfix, Courier, MySQL)

    Hello,
    i have a problem when i test a mail() php function.
    in this test i try to send mail to [email protected] but i doesn't work

    in my mail.log i have :
    Code:
    Dec 23 10:46:23 sd-7683 postfix/pickup[5241]: 41C9761407B: uid=33 from=<www-data>
    Dec 23 10:46:23 sd-7683 postfix/proxymap[5307]: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (111)
    Dec 23 10:46:23 sd-7683 postfix/cleanup[5306]: 41C9761407B: message-id=<[email protected]>
    Dec 23 10:46:23 sd-7683 postfix/qmgr[2298]: 41C9761407B: from=<[email protected]>, size=316, nrcpt=1 (queue active)
    Dec 23 10:46:23 sd-7683 amavis[5187]: (05187-08) connect_to_sql: unable to connect to DSN 'DBI:mysql:database=mail;host=127.0.0.1;port=3306': Can't connect to MySQL server on '127.0.0.1' (111)
    Dec 23 10:46:23 sd-7683 amavis[5187]: (05187-08) TROUBLE in check_mail: creating_partsdir FAILED: SQL server(s) not reachable at (eval 38) line 198, <GEN23> line 8.
    Dec 23 10:46:23 sd-7683 amavis[5187]: (05187-08) PRESERVING EVIDENCE in /var/lib/amavis/amavis-20061223T104623-05187
    Dec 23 10:46:23 sd-7683 postfix/smtp[5309]: 41C9761407B: to=<[email protected]>, relay=127.0.0.1[127.0.0.1], delay=0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 Error in processing, id=05187-08, creating_partsdir FAILED: SQL server(s) not reachable at (eval 38) line 198, <GEN23> line 8. (in reply to end of DATA command))
    
    

    in my.cnf i have a line : bind-address = 127.0.0.1


    master.cf
    Code:
    
    smtp      inet  n       -       -       -       -       smtpd
    pickup    fifo  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      fifo  n       -       -       300     1       qmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    smtp      unix  -       -       -       -       -       smtp
    relay     unix  -       -       -       -       -       smtp
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       n       -       -       lmtp
    anvil     unix  -       -       n       -       1       anvil
    
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -d -t$nexthop -f$sender $recipient
    scalemail-backend unix  -       n       n       -       2       pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    
    
      amavis unix - - - - 2 smtp
            -o smtp_data_done_timeout=1200
            -o smtp_send_xforward_command=yes
    
    127.0.0.1:10025 inet n - - - - smtpd
            -o content_filter=
            -o local_recipient_maps=
            -o relay_recipient_maps=
            -o smtpd_restriction_classes=
            -o smtpd_client_restrictions=
            -o smtpd_helo_restrictions=
            -o smtpd_sender_restrictions=
            -o smtpd_recipient_restrictions=permit_mynetworks,reject
            -o mynetworks=127.0.0.0/8
            -o strict_rfc821_envelopes=yes
            -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
            -o smtpd_bind_address=127.0.0.1
    
    thank you for howto and for all :)
     
    Last edited: Dec 23, 2006
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Either your mysql server is not running or not listening on localhost. Please post the output of:

    netstat -tap
     
  3. Naeh

    Naeh New Member

    thanks for replay :)
    result of : netstat -tap
    Code:
    Connexions Internet actives (serveurs et établies)
    Proto Recv-Q Send-Q Adresse locale          Adresse distante        Etat        PID/Program name
    tcp        0      0 *:imaps                 *:*                     LISTEN     2151/couriertcpd
    tcp        0      0 *:pop3s                 *:*                     LISTEN     2175/couriertcpd
    tcp        0      0 localhost.localdo:10024 *:*                     LISTEN     5783/amavisd (maste
    tcp        0      0 localhost.localdo:10025 *:*                     LISTEN     5631/master
    tcp        0      0 *:pop3                  *:*                     LISTEN     2161/couriertcpd
    tcp        0      0 *:imap2                 *:*                     LISTEN     2131/couriertcpd
    tcp        0      0 *:www                   *:*                     LISTEN     2335/apache2
    tcp        0      0 *:ftp                   *:*                     LISTEN     5434/proftpd: (acce
    tcp        0      0 *:2807                  *:*                     LISTEN     2319/sshd
    tcp        0      0 *:smtp                  *:*                     LISTEN     5631/master
    tcp        0   1040 MyServer:MyPortSSH MyIP ESTABLISHED5256/sshd: ME [pr
    
     
  4. Naeh

    Naeh New Member

    i think that problem is resolved :) edit : no it's false, now i can send mails but not receve :(

    i made changes in my.cnf :
    before :
    Code:
    bind-address            = 127.0.0.1
    skip-networking
    
    after :
    Code:
    bind-address            = 127.0.0.1
    [B][COLOR="Red"]#[/COLOR][/B]skip-networking
    


    the mail() php function work now (i receeved mail in my box @free.fr)

    but when i send mail from this box to emails @ my server, in logs there is no errors, but i have nothing in /home/vmail.
    and i receeve Undelivered Mail Returned to Sender.
    mail.log (after sending mail) :
    Code:
    Dec 23 14:12:12 sd-7683 postfix/smtpd[6205]: connect from smtp5-g19.free.fr[212.27.42.35]
    Dec 23 14:12:12 sd-7683 postfix/smtpd[6205]: ED03961406E: client=smtp5-g19.free.fr[212.27.42.35]
    Dec 23 14:12:12 sd-7683 postfix/cleanup[6207]: ED03961406E: message-id=<[email protected]>
    Dec 23 14:12:12 sd-7683 postfix/smtpd[6205]: disconnect from smtp5-g19.free.fr[212.27.42.35]
    Dec 23 14:12:12 sd-7683 postfix/qmgr[5903]: ED03961406E: from=<[email protected]>, size=718, nrcpt=1 (queue active)
    [COLOR="Red"]Dec 23 14:12:15 sd-7683 dccproc[6212]: socket(UDP): Address family not supported by protocol[/COLOR]
    Dec 23 14:12:16 sd-7683 postfix/smtpd[6215]: connect from localhost.localdomain[127.0.0.1]
    Dec 23 14:12:16 sd-7683 postfix/smtpd[6215]: C521C61407B: client=localhost.localdomain[127.0.0.1]
    Dec 23 14:12:16 sd-7683 postfix/cleanup[6207]: C521C61407B: message-id=<[email protected]>
    Dec 23 14:12:16 sd-7683 postfix/qmgr[5903]: C521C61407B: from=<[email protected]>, size=1163, nrcpt=1 (queue active)
    Dec 23 14:12:16 sd-7683 amavis[5829]: (05829-04) Passed, <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, Hits: 0.35
    Dec 23 14:12:16 sd-7683 postfix/smtp[6208]: ED03961406E: to=<[email protected]>, relay=127.0.0.1[127.0.0.1], delay=4, status=sent (250 2.6.0 Ok, id=05829-04, from MTA: 250 Ok: queued as C521C61407B)
    Dec 23 14:12:16 sd-7683 postfix/qmgr[5903]: ED03961406E: removed
    Dec 23 14:12:16 sd-7683 postfix/smtpd[6215]: disconnect from localhost.localdomain[127.0.0.1]
    Dec 23 14:12:16 sd-7683 postfix/smtp[6217]: C521C61407B: to=<[email protected]>, relay=none, delay=0, status=bounced (mail for mail.naeh.net loops back to myself)
    Dec 23 14:12:16 sd-7683 postfix/cleanup[6207]: D967161409A: message-id=<[email protected]>
    Dec 23 14:12:16 sd-7683 postfix/qmgr[5903]: D967161409A: from=<>, size=2796, nrcpt=1 (queue active)
    Dec 23 14:12:16 sd-7683 postfix/qmgr[5903]: C521C61407B: removed
    Dec 23 14:12:16 sd-7683 postfix/smtp[6217]: D967161409A: to=<[email protected]>, relay=mx1.free.fr[212.27.48.7], delay=0, status=sent (250 ok 1166879523 qp 22947)
    Dec 23 14:12:16 sd-7683 postfix/qmgr[5903]: D967161409A: removed
    
    
    in mail.err there is only lines like this :
    Code:
    dccproc[6212]: socket(UDP): Address family not supported by protocol
     
    Last edited: Dec 23, 2006
  5. Naeh

    Naeh New Member

    can you help me please :(
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Please add mail.naeh.net to mydestination in /etc/postfix/main.cf and restart Postfix.
     
  7. Naeh

    Naeh New Member

    i have this in main.cf :
    Code:
    myhostname = mail.naeh.net
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = mail.naeh.net, localhost, localhost.localdomain
    
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Did you restart Postfix? Do you still have the "loops back to myself" error?
     
  9. Naeh

    Naeh New Member

    mail.naeh.net was already in main.cf (i changed any thing)

    but i want to restars postfix, send mail to my server and i will post mail.log here :)

    thank you very match

    EDIT :
    result :
    Code:
    Dec 24 13:41:39 sd-7683 postfix/postfix-script: refreshing the Postfix mail system
    Dec 24 13:41:39 sd-7683 postfix/master[2300]: reload configuration
    Dec 24 13:42:07 sd-7683 postfix/smtpd[10251]: connect from smtp4-g19.free.fr[212.27.42.30]
    Dec 24 13:42:07 sd-7683 postfix/smtpd[10251]: 3D16D61407A: client=smtp4-g19.free.fr[212.27.42.30]
    Dec 24 13:42:07 sd-7683 postfix/cleanup[10254]: 3D16D61407A: message-id=<[email protected]>
    Dec 24 13:42:07 sd-7683 postfix/qmgr[10246]: 3D16D61407A: from=<[email protected]>, size=717, nrcpt=1 (queue active)
    Dec 24 13:42:07 sd-7683 postfix/smtpd[10251]: disconnect from smtp4-g19.free.fr[212.27.42.30]
    Dec 24 13:42:09 sd-7683 dccproc[10259]: socket(UDP): Address family not supported by protocol
    Dec 24 13:42:10 sd-7683 postfix/smtpd[10262]: connect from localhost.localdomain[127.0.0.1]
    Dec 24 13:42:10 sd-7683 postfix/smtpd[10262]: EDF5561409C: client=localhost.localdomain[127.0.0.1]
    Dec 24 13:42:11 sd-7683 postfix/cleanup[10254]: EDF5561409C: message-id=<[email protected]>
    Dec 24 13:42:11 sd-7683 amavis[2160]: (02160-02) Passed, <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, Hits: 0.35
    Dec 24 13:42:11 sd-7683 postfix/smtp[10255]: 3D16D61407A: to=<[email protected]>, relay=127.0.0.1[127.0.0.1], delay=4, status=sent (250 2.6.0 Ok, id=02160-02, from MTA: 250 Ok: queued as EDF5561409C)
    Dec 24 13:42:11 sd-7683 postfix/smtpd[10262]: disconnect from localhost.localdomain[127.0.0.1]
    Dec 24 13:42:11 sd-7683 postfix/qmgr[10246]: 3D16D61407A: removed
    Dec 24 13:42:11 sd-7683 postfix/qmgr[10246]: EDF5561409C: from=<[email protected]>, size=1162, nrcpt=1 (queue active)
    Dec 24 13:42:11 sd-7683 postfix/smtp[10264]: EDF5561409C: to=<[email protected]>, relay=none, delay=1, status=bounced (mail for mail.naeh.net loops back to myself)
    Dec 24 13:42:11 sd-7683 postfix/cleanup[10254]: 1585C61409D: message-id=<[email protected]>
    Dec 24 13:42:11 sd-7683 postfix/qmgr[10246]: EDF5561409C: removed
    Dec 24 13:42:11 sd-7683 postfix/qmgr[10246]: 1585C61409D: from=<>, size=2795, nrcpt=1 (queue active)
    Dec 24 13:42:11 sd-7683 postfix/smtp[10264]: 1585C61409D: to=<[email protected]>, relay=mx1.free.fr[212.27.48.7], delay=0, status=sent (250 ok 1166964116 qp 532)
    Dec 24 13:42:11 sd-7683 postfix/qmgr[10246]: 1585C61409D: removed
    

    in my box (not @ my server) i receeve this mail :

    Code:
    This is the Postfix program at host mail.naeh.net.
    
    I'm sorry to have to inform you that your message could not be
    be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to <postmaster>
    
    If you do so, please include this problem report. You can
    delete your own text from the attached returned message.
    
    			The Postfix program
    
    <[email protected]>: mail for mail.naeh.net loops back to myself
    
    
    
    Reporting-MTA: dns; mail.naeh.net
    X-Postfix-Queue-ID: EDF5561409C
    X-Postfix-Sender: rfc822; [email protected]
    Arrival-Date: Sun, 24 Dec 2006 13:42:10 +0100 (CET)
    
    Final-Recipient: rfc822; [email protected]
    Action: failed
    Status: 5.0.0
    Diagnostic-Code: X-Postfix; mail for mail.naeh.net loops back to myself
    
    
    
    Sujet:
    test
    De:
    Naeh2 <[email protected]>
    Date:
    Sun, 24 Dec 2006 13:40:43 +0100
    Pour:
    [email protected]
    
    test 
     
    Last edited: Dec 24, 2006
  10. falko

    falko Super Moderator Howtoforge Staff

    Then remove mail.naeh.net from the mydestination line and add it to the domains table in the MySQL database. Restart Postfix afterwards.
     
  11. Naeh

    Naeh New Member

    if i do this, when i try de send message to [email protected] i have error "domain not found" in thunderbird.
     
  12. falko

    falko Super Moderator Howtoforge Staff

    But naeh.net exists in the domains table as well, doesn't it?
     
  13. Naeh

    Naeh New Member

    yes it exists
     
  14. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    postconf -n
    ?
     
  15. Naeh

    Naeh New Member

    I reinstalled all, since that did not works I chose another way and it goes very well. thank you very much for your help :)
     

Share This Page