HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=4)
-   -   Cannot Send mail & Piwik error (http://www.howtoforge.com/forums/showthread.php?t=60227)

ohdude 15th January 2013 15:38

Cannot Send mail & Piwik error
 
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
http://img202.imageshack.us/img202/3...underbirda.jpg

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)

falko 16th January 2013 17:10

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

ohdude 16th January 2013 19:57

Mail.warn

PHP Code:

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 Code:

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 


falko 18th January 2013 11:10

Looks like something else is occupying port 25. What's the output of
Code:

netstat -tap
?

ohdude 18th January 2013 11:22

netstat -tap

PHP Code:

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

falko 21st January 2013 19:23

Looks ok. Have you tried to reboot the system?

ohdude 21st January 2013 19:25

about 10 times

falko 22nd January 2013 21:02

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


All times are GMT +2. The time now is 09:07.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.