php mail() broken all mail

Discussion in 'Installation/Configuration' started by Apollo, Jan 31, 2007.

  1. Apollo

    Apollo New Member

    After having some problems with ISPConfig mail, I reinstalled the lot on my dedicated server again today.

    The server name is: apollo.danieldavies.co.uk
    Code:
    root@apollo:/# hostname   
    apollo.danieldavies.co.uk
    
    I am following the guide line by line for Ubuntu 5.10, and everything worked really well. I pointed the DNS server for my domain, studio-e.co.uk at my dedicated server. danieldavies.co.uk DNS is managed elsewhere, so i created two a records, ns1.danieldavies.co.uk and ns2.danieldavies.co.uk both to apollo. I created one account for the site, studio-e.co.uk, web1_daniel. I added the IMAP account to Evolution and sent a couple of test mails which were received, and I replied to them. Squirrelmail worked well also, allowed me to send an recieve.

    The problem came when I added a php contact form to my website. I have tried using both:
    Code:
    $from = "[email protected]";	
    mail("$to", "$subject", "$msg", "$headers", "-f$from");
    
    and
    
    mail("$to", "$subject", "$msg", "$headers"");
    
    I sent an email through both mail functions, and it did not work either time. I also can no longer send or recieve emails to [email protected] from external accounts such as hotmail/gmail. No error emails are received when sending, and I have this showing up in the log when I send from the php form. Here is the output I get from tail -f on /var/log/mail.log:

    Code:
    Jan 31 21:03:05 apollo sendmail[8672]: l0VL355k008672: Authentication-Warning: apollo.danieldavies.co.uk: www-data set sender to [email protected] using -f
    Jan 31 21:03:05 apollo sendmail[8672]: l0VL355k008672: [email protected], size=438, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@localhost
    Jan 31 21:03:06 apollo sm-mta[8673]: l0VL365O008673: from=<[email protected]>, size=788, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]
    Jan 31 21:03:06 apollo sendmail[8672]: l0VL355k008672: [email protected], [email protected] (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30438, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l0VL365O008673 Message accepted for delivery)
    Jan 31 21:03:06 apollo sm-mta[8675]: l0VL365O008673: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120788, relay=studio-e.co.uk. [80.68.91.44], dsn=4.0.0, stat=Deferred: Connection refused by studio-e.co.uk.
    
    And the tail output when I try using mail without the "-f$form"
    Code:
    Jan 31 21:05:56 apollo sendmail[8725]: l0VL5ufA008725: from=www-data, size=438, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@localhost
    Jan 31 21:05:57 apollo sm-mta[8726]: l0VL5vWm008726: from=<[email protected]>, size=681, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MSP-v4, relay=localhost [127.0.0.1]
    Jan 31 21:05:58 apollo sendmail[8725]: l0VL5ufA008725: [email protected], ctladdr=www-data (33/33), delay=00:00:02, xdelay=00:00:01, mailer=relay, pri=30438, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (l0VL5vWm008726 Message accepted for delivery)
    Jan 31 21:05:58 apollo sm-mta[8728]: l0VL5vWm008726: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=00:00:01, xdelay=00:00:00, mailer=esmtp, pri=120681, relay=studio-e.co.uk. [80.68.91.44], dsn=4.0.0, stat=Deferred: Connection refused by studio-e.co.uk.
    
    As I said, this was working before I tried to use the PHP mail, so I am confident that all the is correct, and Maildir is selected in the settings > mail. You can view the phpinfo() here: http://www.studio-e.co.uk/info.php.

    /etc/postfix/main.cf
    Code:
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    #delay_warning_time = 4h
    myhostname = apollo.danieldavies.co.uk
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    #mydestination = apollo.danieldavies.co.uk, dev.bytemark.co.uk, localhost.bytemark.co.uk, localhost
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes 
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    mailbox_command = 
    home_mailbox = Maildir/
    
    mydestination = /etc/postfix/local-host-names
    virtual_maps = hash:/etc/postfix/virtusertable 
    
    /etc/postfix/virtusertable
    Code:
    [email protected]    web1_daniel
    [email protected]    web1_daniel
    [email protected]    web1_daniel
    [email protected]    web1_daniel
    
    /etc/postfix/local-host-names
    Code:
    localhost
    apollo.danieldavies.co.uk
    localhost.apollo.danieldavies.co.uk
    localhost.danieldavies.co.uk
    www.studio-e.co.uk
    studio-e.co.uk
    
    I have a feeling that the failed mails from the form are staying in some kind of queue, which is preventing all future email getting through.

    Firstly, can anyone suggest anyway to get the php mail() function working
    Secondly, how can I clean out the queue, so all the failed emails are removed from the system

    Thanks in advance to anyone who can give any assistance on this issue. If anymore info is needed please ask.
     
  2. Apollo

    Apollo New Member

    Oh, and I should mention, i can send emails through the php form if i send them to email address outside of of my server (ie hotmail.com emails)
     
  3. Apollo

    Apollo New Member

    Ok, please ignore me. Despite everything working just fine before using the php mail() form, and not after using it, postfix managed to disappear :confused:. I did apt-get install postfix (despite my bash history showing i did this during setup) and it installed it, and all working, including the form.
     

Share This Page