mail server not working

Discussion in 'Server Operation' started by layla, Nov 23, 2006.

  1. layla

    layla New Member

    have my sites up, but have no email facility, it says that it is working, but i get a fatal error when i try to log in has any one any ideas, please help,
    layla
     
  2. falko

    falko Super Moderator ISPConfig Developer

    What's in your mail log?
     
  3. layla

    layla New Member

    ill post it but where is the mail log?
     
  4. layla

    layla New Member

    i have a mail log php
    is this what you mean
    <?php
    /*
    Copyright (c) 2005, projektfarm Gmbh, Till Brehm, Falko Timme
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
    may be used to endorse or promote products derived from this software without
    specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */

    $FILE = "/root/ispconfig/scripts/shell/mail_logs.php";
    $monat = date("m/Y");
    $monat_kurz = date("M");
    $jahr = date("Y");
    $datum = date("d-m-y_H-i-s");
    $current_time = time();
    $web_doctype_id = 1013;
    $user_doctype_id = 1014;
    $domain_doctype_id = 1015;
    include("/root/ispconfig/scripts/lib/config.inc.php");
    include("/root/ispconfig/scripts/lib/server.inc.php");
    $server_id = $mod->system->server_id;
    $dist_mail_log = $mod->system->server_conf["dist_mail_log"];
    $dist_init_scripts = $mod->system->server_conf["dist_init_scripts"];

    if(!is_file($dist_mail_log)) die();
    $server = $mod->system->server_conf;

    $path_httpd_root = stripslashes($server["server_path_httpd_root"]);
    $dienst = $mod->db->queryOneRecord("SELECT * FROM isp_dienste");

    if($dienst["dienst_smtp_status"] == "on") $mod->system->daemon_init($mod->system->server_conf["server_mta"], "stop");

    $mod->log->caselog("cp -f $dist_mail_log $dist_mail_log.$datum", $FILE, __LINE__);
    if($server["server_mail_log_save"]){
    $mod->log->caselog("touch $dist_mail_log.ispconfigsave", $FILE, __LINE__);
    $mod->log->caselog("cat $dist_mail_log >> $dist_mail_log.ispconfigsave", $FILE, __LINE__);
    }

    $fp = fopen($dist_mail_log, "w");
    fwrite($fp, "");
    fclose($fp);

    if($dienst["dienst_smtp_status"] == "on") $mod->system->daemon_init($mod->system->server_conf["server_mta"], "start");


    exec("uniq $dist_mail_log.$datum $dist_mail_log.$datum2"); //doppelte Zeilen löschen
    exec("rm -f $dist_mail_log.$datum");
    exec("mv $dist_mail_log.$datum2 $dist_mail_log.$datum");

    $fp = fopen ($dist_mail_log.".".$datum, "r");
    $mail_log_contents = fread($fp, filesize ($dist_mail_log.".".$datum));
    fclose($fp);
    while(strstr($mail_log_contents, " ")){
    $mail_log_contents = str_replace(" ", " ", $mail_log_contents);
    }
    $fp = fopen ($dist_mail_log.".".$datum, "w");
    fwrite($fp,$mail_log_contents);
    fclose($fp);

    $webs = $mod->db->queryAllRecords("select * from isp_nodes,isp_isp_web WHERE server_id = '$server_id' AND isp_nodes.doc_id = isp_isp_web.doc_id AND isp_nodes.doctype_id = '".$web_doctype_id."' AND isp_nodes.status = '1'");

    foreach($webs as $web){
    $vhost = $web["web_host"].".".$web["web_domain"];
    $domain = $web["web_domain"];
    $web_id = $web["doc_id"];
    $gruppe = "web".$web_id;
    $domain_arr[] = $domain;

    exec("grep -iw ".$mod->system->server_conf["server_mta"]." $dist_mail_log.$datum | grep -iw from | grep -iw $domain | grep -iw $monat_kurz | cut -f2 -d, | cut -f2 -d= > $dist_mail_log.$vhost");

    $codomains = $mod->db->queryAllRecords("SELECT isp_isp_domain.domain_domain from isp_dep,isp_isp_domain where isp_dep.child_doc_id = isp_isp_domain.doc_id and isp_dep.child_doctype_id ='$domain_doctype_id' and isp_dep.parent_doctype_id = '$web_doctype_id' and isp_dep.parent_doc_id = '".$web["doc_id"]."' and isp_isp_domain.status != 'd'");

    foreach($codomains as $codomain){
    if(!in_array($codomain["domain_domain"], $domain_arr)) exec("grep -iw ".$mod->system->server_conf["server_mta"]." $dist_mail_log.$datum | grep -iw from | grep -iw ".$codomain["domain_domain"]." | grep -iw $monat_kurz | cut -f2 -d, | cut -f2 -d= >> $dist_mail_log.$vhost");
    $domain_arr[] = $codomain["domain_domain"];
    }
    unset($domain_arr);
    $traffic = 0;

    $fd = fopen("$dist_mail_log.$vhost", "r");
    while(!feof($fd)){
    $buffer = trim(fgets($fd, 4096));
    if(is_numeric($buffer)) $traffic += $buffer;
    }
    fclose ($fd);

    /////////// INCOMING MAILS ////////////
    $users = $mod->db->queryAllRecords("SELECT * from isp_dep, isp_isp_user where isp_dep.parent_doc_id = $web_id and isp_dep.parent_doctype_id = $web_doctype_id and isp_dep.child_doc_id = isp_isp_user.doc_id and isp_dep.child_doctype_id = $user_doctype_id");

    if(!empty($users)){
    foreach($users as $user){
    if(is_file("/home/admispconfig/mailstats/".$user["user_username"])){
    $fd = fopen("/home/admispconfig/mailstats/".$user["user_username"], "r");
    while(!feof($fd)){
    $buffer = trim(fgets($fd, 4096));
    if(is_numeric($buffer)) $traffic += $buffer;
    }
    fclose ($fd);
    $mod->log->caselog("rm -f /home/admispconfig/mailstats/".$user["user_username"], $FILE, __LINE__);
    }
    }
    }
    /////////// INCOMING MAILS ENDE ///////


    $verify = $mod->db->queryAllRecords("SELECT * FROM isp_traffic WHERE web_id = '$web_id' AND monat = '$monat'");
    if(empty($verify)){
    $mod->db->query("INSERT INTO isp_traffic (web_id, monat, jahr, bytes_mail, datum) VALUES ('$web_id','$monat','$jahr','$traffic','$current_time')");
    } else {
    $mod->db->query("UPDATE isp_traffic SET bytes_mail = bytes_mail + $traffic WHERE web_id = '$web_id' AND monat = '$monat'");
    }
    $mod->log->caselog("rm -f $dist_mail_log.$vhost", $FILE, __LINE__);
    }
    $mod->log->caselog("rm -f $dist_mail_log.$datum", $FILE, __LINE__);
    ?>
     
  5. falko

    falko Super Moderator ISPConfig Developer

    No, the mail log is in /var/log, e.g. /var/log/mail, /var/log/mail.log, /var/log/maillog, depending on your distribution.
     
  6. layla

    layla New Member

    my maillog

    Nov 24 23:59:02 server1 sendmail[4880]: alias database /etc/aliases rebuilt by root
    Nov 24 23:59:02 server1 sendmail[4880]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
    Nov 24 23:59:03 server1 postfix/postfix-script: starting the Postfix mail system
    Nov 24 23:59:03 server1 postfix/master[4926]: daemon started -- version 2.3.3, configuration /etc/postfix
    Nov 24 23:59:03 server1 postfix/qmgr[4928]: 70AFC100D8: from=<[email protected]>, size=754, nrcpt=1 (queue active)
    Nov 24 23:59:24 server1 postfix/smtp[4934]: 70AFC100D8: to=<[email protected]>, relay=none, delay=1762, delays=1741/1.6/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=server1.stiffmiddlefinger.com type=MX: Host not found, try again)
    Nov 25 00:00:01 server1 sendmail[4999]: kAP001rJ004999: from=root, size=183, class=0, nrcpts=1, msgid=<[email protected]>, [email protected]
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: cannot load Certificate Authority data
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: warning: TLS library problem: 5000:error:02001002:system library:fopen:No such file or directory:bss_file.c:122:fopen('/etc/postfix/ssl/cacert.pem','r'):
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: warning: TLS library problem: 5000:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:125:
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: warning: TLS library problem: 5000:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:279:
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: connect from server1.stiffmiddlefinger.com[127.0.0.1]
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: 6F9F1100DC: client=server1.stiffmiddlefinger.com[127.0.0.1], [email protected]
    Nov 25 00:00:01 server1 postfix/cleanup[5002]: 6F9F1100DC: message-id=<[email protected]>
    Nov 25 00:00:01 server1 postfix/qmgr[4928]: 6F9F1100DC: from=<[email protected]>, size=753, nrcpt=1 (queue active)
    Nov 25 00:00:01 server1 sendmail[4999]: kAP001rJ004999: [email protected], ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30183, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 6F9F1100DC)
    Nov 25 00:00:01 server1 postfix/smtpd[5000]: disconnect from server1.stiffmiddlefinger.com[127.0.0.1]
    Nov 25 00:00:21 server1 postfix/smtp[4934]: 6F9F1100DC: to=<[email protected]>, relay=none, delay=20, delays=0.06/0/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=server1.stiffmiddlefinger.com type=MX: Host not found, try again)
    Nov 25 00:00:48 server1 postfix/postfix-script: stopping the Postfix mail system
    Nov 25 00:00:48 server1 postfix/master[4926]: terminating on signal 15
    Nov 25 00:00:49 server1 sendmail[5395]: alias database /etc/aliases rebuilt by root
    Nov 25 00:00:49 server1 sendmail[5395]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
    Nov 25 00:00:49 server1 postfix/postfix-script: starting the Postfix mail system
    Nov 25 00:00:49 server1 postfix/master[5519]: daemon started -- version 2.3.3, configuration /etc/postfix
    Nov 25 00:00:52 server1 postfix/postfix-script: stopping the Postfix mail system
    Nov 25 00:00:52 server1 postfix/master[5519]: terminating on signal 15
    Nov 25 00:00:52 server1 sendmail[5806]: alias database /etc/aliases rebuilt by root
    Nov 25 00:00:52 server1 sendmail[5806]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
    Nov 25 00:00:53 server1 postfix/postfix-script: starting the Postfix mail system
    Nov 25 00:00:53 server1 postfix/master[5852]: daemon started -- version 2.3.3, configuration /etc/postfix
    Nov 25 00:14:52 server1 postfix/postfix-script: stopping the Postfix mail system
    Nov 25 00:14:52 server1 postfix/master[5852]: terminating on signal 15
    Nov 25 00:14:52 server1 sendmail[7523]: alias database /etc/aliases rebuilt by root
    Nov 25 00:14:52 server1 sendmail[7523]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
    Nov 25 00:14:52 server1 postfix/postfix-script: starting the Postfix mail system
    Nov 25 00:14:52 server1 postfix/master[7569]: daemon started -- version 2.3.3, configuration /etc/postfix
    Nov 25 00:14:56 server1 dovecot: pop3-login: Disconnected: rip=::ffff:127.0.0.1, lip=::ffff:127.0.0.1, secured
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: cannot load Certificate Authority data
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: warning: TLS library problem: 7639:error:02001002:system library:fopen:No such file or directory:bss_file.c:122:fopen('/etc/postfix/ssl/cacert.pem','r'):
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: warning: TLS library problem: 7639:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:125:
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: warning: TLS library problem: 7639:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:279:
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: connect from server1.stiffmiddlefinger.com[127.0.0.1]
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: lost connection after CONNECT from server1.stiffmiddlefinger.com[127.0.0.1]
    Nov 25 00:14:56 server1 postfix/smtpd[7639]: disconnect from server1.stiffmiddlefinger.com[127.0.0.1]
    Nov 25 00:31:33 server1 postfix/qmgr[7574]: 70AFC100D8: from=<[email protected]>, size=754, nrcpt=1 (queue active)
    Nov 25 00:31:33 server1 postfix/qmgr[7574]: 6F9F1100DC: from=<[email protected]>, size=753, nrcpt=1 (queue active)
    Nov 25 00:31:33 server1 postfix/local[7976]: 70AFC100D8: to=<[email protected]>, relay=local, delay=3691, delays=3691/0.07/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)
    Nov 25 00:31:33 server1 postfix/qmgr[7574]: 70AFC100D8: removed
    Nov 25 00:31:34 server1 postfix/local[7977]: 6F9F1100DC: to=<[email protected]>, relay=local, delay=1893, delays=1892/0.06/0/0.79, dsn=2.0.0, status=sent (delivered to mailbox)
    Nov 25 00:31:34 server1 postfix/qmgr[7574]: 6F9F1100DC: removed
    Nov 25 00:37:03 server1 postfix/postfix-script: stopping the Postfix mail system
    Nov 25 00:37:03 server1 postfix/master[7569]: terminating on signal 15
    Nov 25 00:37:04 server1 sendmail[9126]: alias database /etc/aliases rebuilt by root
    Nov 25 00:37:04 server1 sendmail[9126]: /etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
    Nov 25 00:37:05 server1 postfix/postfix-script: starting the Postfix mail system
    Nov 25 00:37:05 server1 postfix/master[9182]: daemon started -- version 2.3.3, configuration /etc/postfix
    Nov 25 00:47:57 server1 dovecot: pop3-login: Login: user=<web1_layla>, method=PLAIN, rip=::ffff:127.0.0.1, lip=::ffff:127.0.0.1, secured
    Nov 25 00:47:57 server1 dovecot: POP3(web1_layla): Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
    Nov 25 00:49:00 server1 postfix/smtpd[9456]: cannot load Certificate Authority data
    Nov 25 00:49:00 server1 postfix/smtpd[9456]: warning: TLS library problem: 9456:error:02001002:system library:fopen:No such file or
     
  7. layla

    layla New Member

    there is more, do you need that also
     
  8. Hans

    Hans Moderator ISPConfig Developer

    DNS-records

    Within the DNS records of the DNS-provider where you register your domain, you have to create a MX-10 record which points to server1.stiffmiddlefinger.com

    Within these DNS records you also have to set CNAMES.
    For example, you can use www, pop3 & smtp which point to server1.stiffmiddlefinger.com

    I wonder if you did that..
     
  9. layla

    layla New Member

    hi, im not sure what ive done, but it all seems ok at the moment, finall, take a look at my site
    ww.stiffmiddlefinger.com
    thankyou for your advise
    layla
     

Share This Page