Cannot Send mail & Piwik error

Discussion in 'Installation/Configuration' started by ohdude, Jan 15, 2013.

  1. ohdude

    ohdude New Member

    Hi everyone,

    I've got a little problem, First of all I cannot send any mails, using the PHP mail function. Using this code

    <?php
    $datum = date("j/n/Y");
    mysql_connect("127.0.0.1", "*****", "*****")or die(mysql_error());
    mysql_select_db("c0Controleonline") or die(mysql_error());
    $resultuser = mysql_query( "select * from Gebruikers, Meldingen, Plaatsen where Gebruikers.MijnPro = Plaatsen.Provincie and Meldingen.Plaats = Plaatsen.PlaatsID and Gebruikers.Activated = '1' and Meldingen.Sended = '1' and datum = '$datum' ");
    if ($resultuser !== false) {
    include 'config.php';
    while($row=mysql_fetch_array($resultuser)){
    $message = "Beste ".$row['Username'].",<br />
    Wij hebben weer een melding door gekregen.<br />
    Plaats: ".$row['Plaatsnaam']."
    <br />Provincie: ".$row['Provincie']."
    <br />Datum:".$row['Datum']."
    <br />Tijd:".$row['Tijd']."<br />
    Ter hoogte van: ".$row['thv']."<br />Melding: <img src=$websiteurl/images/Meld/".$row['soort'] .".jpg /><br /><br />Je krijgt deze meldingen omdat je je aangemeld hebt op $websitetitle. <br /> Wil je dit opzeggen dan kun je dit instellen in je account <br />
    <br />
    <p><strong>Met vriendelijke groeten,</strong></p>
    <p><strong>Het $websitetitle team</strong></p><br />
    <br />
    $websiteurl";
    $subject = "Meldingen";

    // To send HTML mail, the Content-type header must be set
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Additional headers
    $headers .= 'From: Controle-online melder <automailer@controle-online.nl>' . "\r\n";
    mail($row['Email'], $subject, $message,$headers);



    }
    mysql_query("UPDATE Meldingen,Gebruikers,Plaatsen SET Meldingen.Sended='0'
    WHERE Gebruikers.MijnPro = Plaatsen.Provincie and Meldingen.Plaats = Plaatsen.PlaatsID and Meldingen.Sended = '1'")or die(mysql_error());
    }
    else {
    echo mysql_error();
    }
    ?>

    Database updated but no mail send ,
    I cannot connect via example thunderbird
    [​IMG]

    I also cannot reach the twitter API and post on twitter well Itested on another server (my synology server)


    Greets,


    Daan

    PS. Its running on a VPS from https://www.budgetvm.com (openvz)
     
  2. falko

    falko Super Moderator

    Are there any errors in your mail log (in the /var/log/ directory)?
     
  3. ohdude

    ohdude New Member

    Mail.warn

    PHP:
    Jan 15 04:45:33 server1 sm-mta[773]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :45:35 server1 sm-msp-queue[778]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :46:33 server1 sm-mta[773]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :46:33 server1 sm-mta[773]: gethostbyaddr(127.0.0.2failed1
    Jan 15 04
    :46:35 server1 sm-msp-queue[778]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :46:50 server1 sm-mta[773]: gethostbyaddr(199.231.215.201failed2
    Jan 15 04
    :46:51 server1 sm-mta[773]: gethostbyaddr(198.98.102.222failed1
    Jan 15 04
    :48:32 server1 sm-mta[648]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :48:34 server1 sm-msp-queue[653]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :49:32 server1 sm-mta[648]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :49:32 server1 sm-mta[648]: gethostbyaddr(127.0.0.2failed1
    Jan 15 04
    :49:34 server1 sm-msp-queue[653]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :49:49 server1 sm-mta[648]: gethostbyaddr(199.231.215.201failed2
    Jan 15 04
    :49:50 server1 sm-mta[648]: gethostbyaddr(198.98.102.222failed1
    Jan 15 05
    :02:21 server1 postfix/master[4896]: fatalbind 0.0.0.0 port 25Address already in use
    Jan 15 05:59:35 server1 postfix/master[29338]: fatalbind 0.0.0.0 port 25Address already in use
    Jan 15 06:00:11 server1 postfix/postqueue[30408]: warningMail system is down -- accessing queue directly
    Mail.err

    PHP:
    Jan 15 04:45:33 server1 sm-mta[773]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :45:35 server1 sm-msp-queue[778]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :46:33 server1 sm-mta[773]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :46:35 server1 sm-msp-queue[778]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :48:32 server1 sm-mta[648]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :48:34 server1 sm-msp-queue[653]: My unqualified host name (server1unknownsleeping for retry
    Jan 15 04
    :49:32 server1 sm-mta[648]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 04
    :49:34 server1 sm-msp-queue[653]: unable to qualify my own domain name (server1) -- using short name
    Jan 15 05
    :02:21 server1 postfix/master[4896]: fatalbind 0.0.0.0 port 25Address already in use
    Jan 15 05:59:35 server1 postfix/master[29338]: fatalbind 0.0.0.0 port 25Address already in use
     
  4. falko

    falko Super Moderator

    Looks like something else is occupying port 25. What's the output of
    Code:
    netstat -tap
    ?
     
  5. ohdude

    ohdude New Member

    netstat -tap

    PHP:
    tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN      
    1945
    /apache2                                                                    
    tcp6       0      0 
    [::]:http               [::]:*                  LISTEN      
    1945
    /apache2                                                                    
    tcp6       0      0 
    [::]:tproxy             [::]:*                  LISTEN      
    1945
    /apache2                                                                    
    tcp6       0      0 
    [::]:ftp                [::]:*                  LISTEN      
    1305
    /pure-ftpd (SER                                                             
    tcp6       0      0 
    [::]:domain             [::]:*                  LISTEN      
    542
    /named                                                                       
    tcp6       0      0 
    [::]:ssh                [::]:*                  LISTEN      
    384
    /sshd                                                                        
    tcp6       0      0 
    [::]:smtp               [::]:*                  LISTEN      
    1293
    /master                                                                     
    tcp6       0      0 localhost
    :953           [::]:*                  LISTEN      
    542
    /named                                                                       
    tcp6       0      0 
    [::]:https              [::]:*                  LISTEN      
    1945
    /apache2                                                                    
    tcp6       0      0 
    [::]:imaps              [::]:*                  LISTEN      
    447
    /dovecot                                                                     
    tcp6       0      0 
    [::]:pop3s              [::]:*                  LISTEN      
    447
    /dovecot                                                                     
    root
    @server1:~# ^C                                                              
    root@server1:~# ^C                                                              
    root@server1:~#           
    this
     
  6. falko

    falko Super Moderator

    Looks ok. Have you tried to reboot the system?
     
  7. ohdude

    ohdude New Member

    about 10 times
     
  8. falko

    falko Super Moderator

    Is it possible you have Sendmail and Postfix installed at the same time? If so, please remove sendmail.
     

Share This Page