PHP mail() in queue

Discussion in 'Installation/Configuration' started by dvancamp, Feb 16, 2011.

  1. dvancamp

    dvancamp New Member

    Hello,

    I have a multiserver setup as outlined in the manual. "Installing A Multiserver Setup With Dedicated Web, Email, DNS And MySQL Database Servers On Debian 5.0 With ISPConfig 3".

    When I use a simple php mail() the mail appears to get stuck in the queue of the web server.

    Code:
    <?php
    $message = "Line 1\nLine 2\nLine 3";
    $message = wordwrap($message, 70);
    mail('[email protected]', 'Test Subject', $message);
    ?>
    
    Code:
    7h 1.2K 1Ppc0V-000348-7c <>
    [email][email protected][/email]
    
    7h 1.2K 1Ppc6b-00035J-DJ <>
    [email][email protected][/email]
    
    7h 1.2K 1Ppc8V-00035d-Fj <>
    [email][email protected][/email]
    
    18m 1.2K 1PpiPe-0004P7-Ol <>
    [email][email protected][/email]
    
    14m 1.2K 1PpiTE-0004Q3-F2 <>
    [email][email protected][/email]
    
    13m 1.2K 1PpiUM-0004QG-TC <>
    [email][email protected][/email]
    
    13m 1.2K 1PpiUR-0004QM-7w <>
    [email][email protected][/email]
    
    10m 1.2K 1PpiXH-0004Sl-Kr <>
    [email][email protected][/email]
    
    Is there some additional configuration that I must do on the webserver in order to get php to send mail reliably? Perhaps the php.ini needs to use the mail server as the smtp instead of trying to send mail through the webserver?

    Thanks for all the help, howtos, and this great forum.
    Dave
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Are there any errors in the mail log?
     
  3. dvancamp

    dvancamp New Member

    Mail-log
    Mail-warn-log
    Mail-error-log

    Are all blank on this server (web1.domain.net); just the Mail queue filling up with php mail.

    The Mail server (mail.domain.net) has an empty queue and no errors. Seems to be working fine.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    netstat -tap
     
  5. dvancamp

    dvancamp New Member

    Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 *:mysql                 *:*                     LISTEN      8437/mysqld     
    tcp        0      0 *:ftp                   *:*                     LISTEN      26081/pure-ftpd (SE
    tcp        0      0 *:ssh                   *:*                     LISTEN      826/sshd        
    tcp        0      0 localhost:smtp          *:*                     LISTEN      8317/exim4      
    tcp        0     48 web1.domain.net:ssh     adsl-222-333-444.:57684 ESTABLISHED 18822/sshd: dvancam
    tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN      17265/apache2   
    tcp6       0      0 [::]:www                [::]:*                  LISTEN      17265/apache2   
    tcp6       0      0 [::]:tproxy             [::]:*                  LISTEN      17265/apache2   
    tcp6       0      0 [::]:ftp                [::]:*                  LISTEN      26081/pure-ftpd (SE
    tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      826/sshd        
    tcp6       0      0 [::]:https              [::]:*                  LISTEN      17265/apache2  
    
    Changed domain name and IP in output...
     
  6. dvancamp

    dvancamp New Member

    O.K. I had a chance to dig around a bit more.

    Saw the the local smtp was using exim4. exim4 logs had the errors
    Code:
    R=nonlocal: Mailing to remote domains not supported
    Followed this howto to reconfigure exim:
    http://www.howtoforge.com/exim-authenticated-smarthost

    (web1.domain.net) was set as "local delivery only; not on a network" changed it to "mail sent by smarthost; no local mail" and used an email username/password to authenticate to the SMTP server on (mail.domain.net).

    Getting mail through the PHP webforms on the site now. Still a little unsure of my settings when reconfiguring exim4... Does this sound reasonable?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, that configuration is ok.
     
  8. (O)fer_cz

    (O)fer_cz New Member

    i have same problem, i tried to setup my exim (im not sure its 100% correct, how to is not very detailed...) i used only dpkg-reconfigure exim4-config and i've created new user on mail server and added it to exim config (not user if this is right authentification username pw??)
    but i got error:
    =FIXED by clearing up panic file=
    2011-12-17 22:07:59 socket bind() to port 25 for address XX.XX.XX.XX failed: Cannot assign requested address: daemon abandoned
    =FIXED=
    how can i make php mail () working on web with multiserver setup?

    i have same problem, i tried to setup my exim (im not sure its 100% correct, how to is not very detailed...) i used only dpkg-reconfigure exim4-config
    but i got error:

    2011-12-17 22:07:59 socket bind() to port 25 for address XX.XX.XX.XX failed: Cannot assign requested address: daemon abandoned

    how can i make php mail () working on web with multiserver setup?


    root@web1:/tmp# netstat -napt|grep 25
    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 16255/exim4


    root@web1:/tmp# netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 *:mysql *:* LISTEN 3569/mysqld
    tcp 0 0 *:sunrpc *:* LISTEN 2745/portmap
    tcp 0 0 *:ftp *:* LISTEN 30301/pure-ftpd (SE
    tcp 0 0 *:ssh *:* LISTEN 3429/sshd
    tcp 0 0 localhost:smtp *:* LISTEN 16255/exim4
    tcp 0 0 *:51261 *:* LISTEN 2757/rpc.statd


    =CURRENT PROBLEM=
    2011-12-18 00:26:48 1Rc3eS-0004oq-Ah <= [email protected] U=root P=local S=420
    2011-12-18 00:26:50 1Rc3eS-0004oq-Ah plain authenticator failed H=mail.mydomain.com [mail server IP] 535 5.7.8 Error: authentication failed:
    2011-12-18 00:26:52 1Rc3eS-0004oq-Ah login authenticator failed H=mail.mydomain.com [mail server IP] 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
    2011-12-18 00:26:52 1Rc3eS-0004oq-Ah ** [email protected] R=smarthost T=remote_smtp_smarthost: SMTP error from remote mail server after RCPT TO:<[email protected]>: host mail.mydomain.com [89.185.250.134]: 554 5.7.1 <[email protected]>: Relay access denied
    2011-12-18 00:26:52 1Rc3eW-0004ot-8z <= <> R=1Rc3eS-0004oq-Ah U=Debian-exim P=local S=1382
    2011-12-18 00:26:52 1Rc3eS-0004oq-Ah Completed
    2011-12-18 00:26:54 1Rc3eW-0004ot-8z plain authenticator failed H=mail.mydomain.com [mail server IP] 535 5.7.8 Error: authentication failed:
    2011-12-18 00:26:56 1Rc3eW-0004ot-8z login authenticator failed H=mail.mydomain.com [mail server IP] 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
    2011-12-18 00:26:56 1Rc3eW-0004ot-8z ** [email protected] R=smarthost T=remote_smtp_smarthost: SMTP error from remote mail server after RCPT TO:<[email protected]>: host mail.mydomain.com [89.185.250.134]: 554 5.7.1 <[email protected]>: Relay access denied
    2011-12-18 00:26:56 1Rc3eW-0004ot-8z Frozen (delivery error message)
    root@web1:/tmp#
     
    Last edited: Dec 18, 2011
  9. (O)fer_cz

    (O)fer_cz New Member

    ok, so i figured this out, i have to authentificate againts user/pass in dbispconfig mail_users, but i dont have any mail domains operated by ISPC (im using google apps), so i cant create username manualy. can i authentificate it agains something else?
     
    Last edited: Dec 18, 2011
  10. (O)fer_cz

    (O)fer_cz New Member

    and i've noticed, that in /var/spool/mail is lot of lot of automated emails from presta shop etc and system messages (see example below), even on my db server, ns server... should this be fixed as well as above? or i've got problem somewhere else?


    From [email protected] Sun Dec 18 20:51:11 2011
    Return-path: <[email protected]>
    Envelope-to: [email protected]
    Delivery-date: Sun, 18 Dec 2011 20:51:11 +0100
    Received: from root by db.mydomain.com with local (Exim 4.72)
    (envelope-from <[email protected]>)
    id 1RcMlL-0003LX-40
    for [email protected]; Sun, 18 Dec 2011 20:51:11 +0100
    Date: Sun, 18 Dec 2011 20:51:11 +0100
    Message-Id: <[email protected]>
    To: [email protected]
    Subject: info: mpt raid status change on db.mydomain.com
    From: root <[email protected]>

    This is a RAID status update from mpt-statusd. The mpt-status
    program reports that one of the RAIDs changed state:


    Report from /etc/init.d/mpt-statusd on db.mydomain.com
     

Share This Page