Link to home
Start Free TrialLog in
Avatar of starhu
starhu

asked on

Php mail doesn't work on the new server

Hello,

The following php code doesn't work on our new Ubuntu server. It doesn't give error message but It doesn't send the email either. I suppose this should be some setting on the server we didn't set.


if(mail($to,$subject,$body,$headers))
    {
     
//
 print "mail sent OK";
    }
    else
    {
        print "FAILED sending message<PRE>";
        print_r(error_get_last());
    }

Thank you
Avatar of xterm
xterm

Please try adding the following lines to your test page so that we can see some debug output from the failure:

ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting(E_ALL | E_STRICT);

Then run it again, and paste what it says.  Thanks.
Avatar of Dave Baldwin
Did you set up a mail server like Sendmail or Postfix on your Ubuntu server?
Avatar of starhu

ASKER

No I didn't set up mail server.
Is mail server for both receiving and sending?

I don't know to set one up. Can you send me some links to help?

Thank you
I would assume a "server" installation would have this by default.  First check the processlist to see if postfix or sendmail is running, but if not, simply do below
sudo apt-get install sendmail
sudo /etc/init.d/sendmail start

Open in new window

Avatar of starhu

ASKER

I think postfix is installed because sudo apt-get install sendmail gave me this:

 
The following extra packages will be installed:
  m4 procmail sendmail-base sendmail-bin sendmail-cf sensible-mda
Suggested packages:
  sendmail-doc rmail logcheck resolvconf
The following packages will be REMOVED:
  postfix postfix-mysql
The following NEW packages will be installed:
  m4 procmail sendmail sendmail-base sendmail-bin sendmail-cf sensible-mda
0 upgraded, 7 newly installed, 2 to remove and 24 not upgraded.
Need to get 2,068kB of archives.
After this operation, 2,519kB of additional disk space will be used.
Do you want to continue [Y/n]?

Open in new window


What next?
Thanx
If postfix is already installed, you don't need to install sendmail.

Why not insert the debug lines into your PHP code as i first suggested, and let's see what the error is when you attempt to send mail?

You can also locate your apache error_log on the system, perhaps /var/log/httpd, and do "tail -f error_log" when you submit your form.  You should see the error there too.

Then we can know what is happening with the mail attempt.
Avatar of starhu

ASKER

Ok, I created a php file:

 
<?php
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting(E_ALL | E_STRICT);


$to = "mymailaddress@mydomain";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";

?>

Open in new window


It wrote: Mail sent -> but I didn't get anything
Here is my PHP email demo program that has been tested on Linux and Windows IIS servers with PHP 4 and 5.  Save it as 'Email.php' and put in your own email address and try it.  It is more complete than your test program.
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

# some settings of POST vars
if (!isset($_POST['send']))  $send = ''; else $send = $_POST['send'];
if (!isset($_POST['toText'])) $toText = ''; else $toText = $_POST['toText'];
if (!isset($_POST['ccText'])) $ccText = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['subjectText'])) $subjectText = ''; else $subjectText = $_POST['subjectText'];
if (!isset($_POST['msgText'])) $msgText = ''; else $msgText = $_POST['msgText'];
if (!isset($_POST['ccText'])) $ccTexth = ''; else $ccText = $_POST['ccText'];
if (!isset($_POST['bccText'])) $bccText = ''; else $bccText = $_POST['bccText'];
if (!isset($_POST['nameText'])) $nameText = ''; else $nameText = $_POST['nameText'];
if (!isset($_POST['fromText'])) $fromText = ''; else $fromText = $_POST['fromText'];

if ($send == "") {
    $title="Test Email Page";
    $announce="---";
}
else {
	if($fromText === "") die("No name!");
  $toText="youremail@yourdomain.com";
	$title="Test Email Page";
  $announce="Your Message has been Sent!";
	$header = "From: ".$fromText."\r\n";
//	$header .= "Cc: ".$ccText."\n";
	$header .= "Reply-To : ".$fromText."\r\n";
	$header .= "Return-Path : ".$fromText."\r\n";
	$header .= "X-Mailer: PHP\r\n";
	$header .= "MIME-Version: 1.0\r\n";
	$header .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
//	ini_set(sendmail_from,$fromText);  
	mail($toText, $subjectText, $msgText, $header, '-f'.$fromText);
//	ini_restore(sendmail_from);
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo($title)?></title>
<style type="text/css">
<!-- 
A:link { color: #999999; }
A:visited { color: #999999; }
A:hover {color: #0099ff;}
-->
</style>
<script type="text/javascript">
<!--
function check()
{
var at=document.getElementById("fromText").value.indexOf("@");
var eml=document.getElementById("fromText").value;
var nam=document.getElementById("nameText").value;
var alerttxt="";
var submitOK="true";

if (eml.length < 5 || at == -1)
    {
    alerttxt=alerttxt+"Please enter a valid e-mail address!\r\n";
    submitOK="false"
    //return false;
    }
if (nam.length < 3)
    {
    alerttxt=alerttxt+"Please enter your name.\r\n";
    submitOK="false"
    //return false;
    }
if (submitOK=="false")
    {
    alert(alerttxt);
    return false;
    }

}

// -->
</script>
</head>

<body bgcolor="#ddeedd">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" summary="" width="580">
<tr><td align="center">

<?php
if ($send != "") {
   	echo ("To: ".$toText."<br>\r\nSubject: ".$subjectText."<br>\r\n".$msgText."<br>\r\n".$header);
		}
?>

<p><b><font color="#000000" size="5">Test Email</font></b></p>
<font size="4" color="#000000">

<!--   <form method="POST" action="<?php echo($PHP_SELF)?>"> -->
  <form method="POST" action="Email.php" onsubmit="return check();">
    <p><font size="3"><b>Name: <input type="text" name="nameText" id="nameText" size="46"></b></font></p>
    <p><font size="3"><b>Email: <input type="text" name="fromText" id="fromText" size="46"></b></font></p>
    <input type="hidden" name="subjectText" value="Web Mail">
    <p><font face="Arial" size="3"><b>Message Text:</b></font></p>
    <p><font face="Arial" size="3"><b><textarea rows="6" name="msgText" cols="60"></textarea></b></font></p>
    <p><font size="3"><b><input type="submit" value="Send" name="send" style="font-family: Arial; font-size: 12pt; font-weight: bold"></b></font></p>
    <input type="hidden" name="state" value="1">
  </form>
  <b><font face="Arial" size="4" color="#e00000"><?php echo($announce)?></font></b><br><br>

</font>
</td></tr>
</table> 
</div>

</body>
</html>

Open in new window

Avatar of starhu

ASKER

It gave: "Your Message has been Sent!"

How can I check postfix settings? Maybe it is not set correctly
Please type "mailq" on the server, and see if the mails are queued up waiting to go out.

You can also test the ability of your server to deliver mail by doing the following:

"sendmail -bv user@domain.com" (replace that with the $to address you're trying to mail.)

BTW, I know you have Postfix installed, but the sendmail command should be installed for compatibility purposes so as not to break applications and whatnot.   Please give me the output of both commands.
By the way, you need to change this line:

$headers = "From:" . $from;

to

$headers = "From: $from";

The way you have it now will create a header "From:user@domain"  - this is invalid - it needs to be "From: user@domain" (there is a space in there)  Please fix that too.

Avatar of starhu

ASKER

mailq:   Mail queue is empty

 sendmail -bv info@mydomain.com
Mail Delivery Status Report will be mailed to <root>.
Okay, please look in these files for further information:

/var/log/mail.err
/var/log/mail.info
/var/log/mail.log

Thanks.
Avatar of starhu

ASKER

/var/log/mail.err

Oct 23 12:20:39 Ubuntu-1004-lucid-64-minimal pop3d: Maximum connection limit reached for ::ffff:216.245.214.146
Oct 23 12:21:58 Ubuntu-1004-lucid-64-minimal pop3d: last message repeated 16 times      

/var/log/mail.info

 
mail.info          [----]  0 L:[253+59 312/312] *(44041/44041b) <EOF>                                                                                                                                          
Oct 25 19:30:08 Ubuntu-1004-lucid-64-minimal postfix/local[26814]: 529357E8800: to=<bestcom@localhost>, relay=local, delay=0.06, delays=0.03/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 25 19:30:08 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 529357E8800: removed                                                                                                                         
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/smtpd[27111]: connect from localhost[127.0.0.1]                                                                                                           
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/smtpd[27111]: 624397E8800: client=localhost[127.0.0.1]                                                                                                    
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27114]: 624397E8800: message-id=<20111025195020.624397E8800@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 624397E8800: from=<nobody@localhost>, size=541, nrcpt=1 (queue active)                                                                       
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/smtpd[27111]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/local[27115]: 624397E8800: to=<bestcom@localhost>, relay=local, delay=0.06, delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 25 21:50:20 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 624397E8800: removed                                                                                                                         
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/pickup[27044]: 942667E8AA4: uid=33 from=<www-data>                                                                                                        
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27122]: 942667E8AA4: message-id=<20111025195258.942667E8AA4@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 942667E8AA4: from=<www-data@Ubuntu-1004-lucid-64-minimal>, size=411, nrcpt=1 (queue active)                                                  
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/error[27125]: 942667E8AA4: to=<csillag.zsolt@egyediszoftverek.hu>, relay=none, delay=0.09, delays=0.07/0.01/0/0.01, dsn=5.0.0, status=bounced (egyediszoft
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27122]: 9F5567E8AC6: message-id=<20111025195258.9F5567E8AC6@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 9F5567E8AC6: from=<>, size=2342, nrcpt=1 (queue active)                                                                                      
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/bounce[27126]: 942667E8AA4: sender non-delivery notification: 9F5567E8AC6                                                                                 
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 942667E8AA4: removed                                                                                                                         
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/error[27125]: 9F5567E8AC6: to=<www-data@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (Ubuntu-1004-l
Oct 25 21:52:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 9F5567E8AC6: removed                                                                                                                         
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/pickup[27044]: 1E72D7E8AA4: uid=33 from=<piri@piri.net>                                                                                                   
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27220]: 1E72D7E8AA4: message-id=<20111025201230.1E72D7E8AA4@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 1E72D7E8AA4: from=<piri@piri.net>, size=489, nrcpt=1 (queue active)                                                                          
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/error[27224]: 1E72D7E8AA4: to=<csillag.zsolt@egyediszoftverek.hu>, relay=none, delay=0.07, delays=0.05/0.01/0/0.01, dsn=5.0.0, status=bounced (egyediszoft
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27220]: 29A7F7E8AC6: message-id=<20111025201230.29A7F7E8AC6@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 29A7F7E8AC6: from=<>, size=2348, nrcpt=1 (queue active)                                                                                      
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/bounce[27225]: 1E72D7E8AA4: sender non-delivery notification: 29A7F7E8AC6                                                                                 
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 1E72D7E8AA4: removed                                                                                                                         
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/error[27224]: 29A7F7E8AC6: to=<piri@piri.net>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (piri.net)                            
Oct 25 22:12:30 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 29A7F7E8AC6: removed                                                                                                                         
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/pickup[27044]: C14147E8AA4: uid=33 from=<piri@piri.net>                                                                                                   
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27247]: C14147E8AA4: message-id=<20111025201455.C14147E8AA4@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: C14147E8AA4: from=<piri@piri.net>, size=492, nrcpt=1 (queue active)                                                                          
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/error[27250]: C14147E8AA4: to=<csillag.zsolt@egyediszoftverek.hu>, relay=none, delay=0.09, delays=0.06/0.01/0/0.01, dsn=5.0.0, status=bounced (egyediszoft
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27247]: CC8D87E8AC6: message-id=<20111025201455.CC8D87E8AC6@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: CC8D87E8AC6: from=<>, size=2351, nrcpt=1 (queue active)                                                                                      
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/bounce[27251]: C14147E8AA4: sender non-delivery notification: CC8D87E8AC6                                                                                 
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: C14147E8AA4: removed                                                                                                                         
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/error[27250]: CC8D87E8AC6: to=<piri@piri.net>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (piri.net)                            
Oct 25 22:14:55 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: CC8D87E8AC6: removed                                                                                                                         
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/pickup[27044]: 8CC3E7E8AC6: uid=0 from=<root>                                                                                                             
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27264]: 8CC3E7E8AC6: message-id=<20111025203147.8CC3E7E8AC6@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 8CC3E7E8AC6: from=<root@Ubuntu-1004-lucid-64-minimal>, size=321, nrcpt=1 (queue active)                                                      
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/error[27268]: 8CC3E7E8AC6: to=<info@starsoft.hu>, relay=none, delay=0.07, delays=0.05/0.01/0/0.01, dsn=5.0.0, status=undeliverable (starsoft.hu)          
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27264]: 983407E8ACA: message-id=<20111025203147.983407E8ACA@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/bounce[27269]: 8CC3E7E8AC6: sender delivery status notification: 983407E8ACA                                                                              
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 8CC3E7E8AC6: removed                                                                                                                         
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 983407E8ACA: from=<>, size=1947, nrcpt=1 (queue active)                                                                                      
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/error[27268]: 983407E8ACA: to=<root@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.03, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (Ubuntu-1004-lu
Oct 25 22:31:47 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 983407E8ACA: removed                                                                                                                         
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/pickup[27044]: 9DA2A7E8ACA: uid=0 from=<root>                                                                                                             
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27264]: 9DA2A7E8ACA: message-id=<20111025203241.9DA2A7E8ACA@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 9DA2A7E8ACA: from=<root@Ubuntu-1004-lucid-64-minimal>, size=329, nrcpt=1 (queue active)                                                      
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/error[27268]: 9DA2A7E8ACA: to=<info@egyediszoftverek.hu>, relay=none, delay=0.04, delays=0.03/0/0/0, dsn=5.0.0, status=undeliverable (egyediszoftverek.hu)
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/cleanup[27264]: A0ED87E8AC6: message-id=<20111025203241.A0ED87E8AC6@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/bounce[27270]: 9DA2A7E8ACA: sender delivery status notification: A0ED87E8AC6                                                                              
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 9DA2A7E8ACA: removed                                                                                                                         
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: A0ED87E8AC6: from=<>, size=1987, nrcpt=1 (queue active)                                                                                      
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/error[27268]: A0ED87E8AC6: to=<root@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.02, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (Ubuntu-1004-lucid
Oct 25 22:32:41 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: A0ED87E8AC6: removed

Open in new window


/var/log/mail.log
 
mail.log           [----]  0 L:[129+59 188/320] *(26646/44759b) 0079 0x04F                                                                                                                                     
Oct 24 15:43:19 Ubuntu-1004-lucid-64-minimal postfix/smtpd[22073]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 24 15:43:19 Ubuntu-1004-lucid-64-minimal postfix/local[22077]: E66927E8033: to=<bestcom@localhost>, relay=local, delay=0.06, delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 24 15:43:19 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: E66927E8033: removed                                                                                                                         
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/pickup[22038]: 01CBF7E8ABB: uid=33 from=<www-data>                                                                                                        
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22171]: 01CBF7E8ABB: message-id=<20111024141227.01CBF7E8ABB@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 01CBF7E8ABB: from=<www-data@Ubuntu-1004-lucid-64-minimal>, size=1156, nrcpt=4 (queue active)                                                 
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/error[22175]: 01CBF7E8ABB: to=<csillag.szilvia@egyediszoftverek.hu>, relay=none, delay=0.11, delays=0.06/0.01/0/0.04, dsn=5.0.0, status=bounced (egyediszo
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/error[22176]: 01CBF7E8ABB: to=<mulhamer.adam@egyyediszoftverek.hu>, relay=none, delay=0.11, delays=0.06/0.04/0/0.01, dsn=5.0.0, status=bounced (egyyediszo
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/error[22178]: 01CBF7E8ABB: to=<csillag.szilvia@gmail.com>, relay=none, delay=0.12, delays=0.06/0.06/0/0, dsn=5.0.0, status=bounced (gmail.com)            
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/error[22179]: 01CBF7E8ABB: to=<iroda@starsoft.hu>, relay=none, delay=0.13, delays=0.06/0.06/0/0.01, dsn=5.0.0, status=bounced (starsoft.hu)               
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22171]: 18F187E8ACA: message-id=<20111024141227.18F187E8ACA@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 18F187E8ACA: from=<>, size=3617, nrcpt=1 (queue active)                                                                                      
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/bounce[22180]: 01CBF7E8ABB: sender non-delivery notification: 18F187E8ACA                                                                                 
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 01CBF7E8ABB: removed                                                                                                                         
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/error[22175]: 18F187E8ACA: to=<www-data@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (Ubuntu-100
Oct 24 16:12:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 18F187E8ACA: removed                                                                                                                         
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/smtpd[22205]: connect from localhost[127.0.0.1]                                                                                                           
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/smtpd[22205]: 1BC417E88AA: client=localhost[127.0.0.1]                                                                                                    
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22208]: 1BC417E88AA: message-id=<20111024142824.1BC417E88AA@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 1BC417E88AA: from=<nobody@localhost>, size=552, nrcpt=1 (queue active)                                                                       
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/smtpd[22205]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/local[22209]: 1BC417E88AA: to=<bestcom@localhost>, relay=local, delay=0.07, delays=0.04/0.03/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 24 16:28:24 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 1BC417E88AA: removed                                                                                                                         
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/pickup[22316]: 4374D7E88AA: uid=33 from=<www-data>                                                                                                        
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22324]: 4374D7E88AA: message-id=<48fba3c8d7c166f254c0eb6f74ab11c4@85.10.207.168>                                                                  
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 4374D7E88AA: from=<www-data@Ubuntu-1004-lucid-64-minimal>, size=1028, nrcpt=1 (queue active)                                                 
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/error[22328]: 4374D7E88AA: to=<lorincz.karolina@gmail.com>, relay=none, delay=0.11, delays=0.09/0.01/0/0.01, dsn=5.0.0, status=bounced (gmail.com)        
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22324]: 504007E8ABB: message-id=<20111024152307.504007E8ABB@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 504007E8ABB: from=<>, size=2991, nrcpt=1 (queue active)                                                                                      
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/bounce[22329]: 4374D7E88AA: sender non-delivery notification: 504007E8ABB                                                                                 
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 4374D7E88AA: removed                                                                                                                         
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/error[22328]: 504007E8ABB: to=<www-data@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (Ubuntu-1004-l
Oct 24 17:23:07 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 504007E8ABB: removed                                                                                                                         
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/pickup[22316]: 251B77E88AA: uid=33 from=<www-data>                                                                                                        
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22344]: 251B77E88AA: message-id=<d4b3eb8037694738bc7df7f5eca289ab@85.10.207.168>                                                                  
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 251B77E88AA: from=<www-data@Ubuntu-1004-lucid-64-minimal>, size=1037, nrcpt=1 (queue active)                                                 
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/error[22348]: 251B77E88AA: to=<lorincz.karolina@freemail.hu>, relay=none, delay=0.11, delays=0.08/0.01/0/0.02, dsn=5.0.0, status=bounced (freemail.hu)    
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22344]: 31E127E8ABB: message-id=<20111024153056.31E127E8ABB@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 31E127E8ABB: from=<>, size=3008, nrcpt=1 (queue active)                                                                                      
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/bounce[22349]: 251B77E88AA: sender non-delivery notification: 31E127E8ABB                                                                                 
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 251B77E88AA: removed                                                                                                                         
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/error[22348]: 31E127E8ABB: to=<www-data@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (Ubuntu-1004-l
Oct 24 17:30:56 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 31E127E8ABB: removed                                                                                                                         
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/pickup[22316]: 536AF7E8ABB: uid=33 from=<www-data>                                                                                                        
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22384]: 536AF7E8ABB: message-id=<b1fa7a35f63297e6a78ed9a210c605d1@85.10.207.168>                                                                  
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 536AF7E8ABB: from=<www-data@Ubuntu-1004-lucid-64-minimal>, size=1017, nrcpt=1 (queue active)                                                 
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/error[22388]: 536AF7E8ABB: to=<bimbo.csaba@gmail.com>, relay=none, delay=0.11, delays=0.09/0.01/0/0.01, dsn=5.0.0, status=bounced (gmail.com)             
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/cleanup[22384]: 5EE557E8ACA: message-id=<20111024155718.5EE557E8ACA@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 5EE557E8ACA: from=<>, size=2970, nrcpt=1 (queue active)                                                                                      
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/bounce[22389]: 536AF7E8ABB: sender non-delivery notification: 5EE557E8ACA                                                                                 
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 536AF7E8ABB: removed                                                                                                                         
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/error[22388]: 5EE557E8ACA: to=<www-data@Ubuntu-1004-lucid-64-minimal>, relay=none, delay=0.01, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (Ubuntu-100
Oct 24 17:57:18 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 5EE557E8ACA: removed                                                                                                                         
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/smtpd[23090]: connect from localhost[127.0.0.1]                                                                                                           
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/smtpd[23090]: 950C07E8033: client=localhost[127.0.0.1]                                                                                                    
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/cleanup[23093]: 950C07E8033: message-id=<20111024213958.950C07E8033@Ubuntu-1004-lucid-64-minimal>                                                         
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 950C07E8033: from=<nobody@localhost>, size=560, nrcpt=1 (queue active)                                                                       
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/smtpd[23090]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/local[23094]: 950C07E8033: to=<bestcom@localhost>, relay=local, delay=0.07, delays=0.04/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 24 23:39:58 Ubuntu-1004-lucid-64-minimal postfix/qmgr[26636]: 950C07E8033: removed

Open in new window

Okay, so the server is sending all of your mails, but they are bouncing back.  You should be able to find the bounces in /var/mail and read through some of them to see what the error is.  

It is probably because the hostname that your system is using in the return address doesn't resolve in DNS, so the remote servers bounce the mail.  What is the output on your system of the "hostname" command?

Can you show me "cat /etc/hosts"?
Okay, I'll bet I know what it is.  Edit /etc/postfix/main.cf

set:

  myhostname = your.servers.full.host.name

and set:

  mydestination = localhost.localdomain, , localhost

(if anything else appears in front of localhost.localdomain, remove it)

Then do:

  /etc/init.d/postfix restart

Then do:

  sendmail -bv your_email@domain.com

This time, you should not get the line that says "Mail Delivery Status Report will be mailed to <root>."

If that is the case, please try your web form again.
Avatar of starhu

ASKER

please help me with an example of "myhostname = your.servers.full.host.name"

I tried http://www.mydomain.com but there was an error message

I entered hostname.localdomain -> this was accepted but I didn't get the email

code:

 
main.cf            [----] 33 L:[  1+ 0   1/ 73] *(33  /3090b) 0100 0x064                                                                                                   
# See /usr/share/postfix/main.cf.dist for a commented, more complete version                                                                                               


# Debian specific:  Specifying a file name will cause the first                                                                                                            
# line of that file to be used as the name.  The Debian default                                                                                                            
# is /etc/mailname.                                                                                                                                                        
#myorigin = /etc/mailname                                                                                                                                                  

smtpd_banner = $myhostname ESMTP $mail_name powered by Easy Hosting Control Panel (ehcp) on Ubuntu, www.ehcp.net                                                           
biff = no                                                                                                                                                                  

# appending .domain is the MUA's job.                                                                                                                                      
append_dot_mydomain = no                                                                                                                                                   

# Uncomment the next line to generate "delayed mail" warnings                                                                                                              
#delay_warning_time = 4h                                                                                                                                                   

readme_directory = /usr/share/doc/postfix                                                                                                                                  

# TLS parameters                                                                                                                                                           
smtpd_tls_cert_file = /etc/postfix/smtpd.cert                                                                                                                              
smtpd_tls_key_file = /etc/postfix/smtpd.key                                                                                                                                
smtpd_use_tls = yes                                                                                                                                                        
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache                                                                                                    
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache                                                                                                      

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for                                                                                                  
# information on enabling SSL in the smtp client.                                                                                                                          

myhostname = hostname.localdomain                                                                                                                                          
alias_maps = hash:/etc/aliases                                                                                                                                             
alias_database = hash:/etc/aliases                                                                                                                                         
mydestination = localhost.localdomain,localhost, 84.10.208.168                                                                                                             
relayhost =.                                                                                                                                                               
mynetworks = 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/16, 10.0.0.0/8,  84.10.208.0/24                                                                                       
mailbox_size_limit = 0                                                                                                                                                     
recipient_delimiter = +                                                                                                                                                    
inet_interfaces = 127.0.0.1                                                                                                                                                
default_transport = error                                                                                                                                                  
relay_transport = error                                                                                                                                                    
inet_protocols = ipv4                                                                                                                                                      
#mailbox_command = /usr/lib/dovecot/deliver                                                                                                                                
#html_directory = /usr/share/doc/postfix/html                                                                                                                              
virtual_alias_domains =.                                                                                                                                                   
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf                                          
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf                                                                                                      
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf                                                                                                
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf                                                                                                 
virtual_mailbox_base = /home/vmail                                                                                                                                         
virtual_uid_maps = static:5000                                                                                                                                             
virtual_gid_maps = static:5000                                                                                                                                             
smtpd_sasl_auth_enable = yes                                                                                                                                               
smtpd_sasl_security_options = noanonymous                                                                                                                                  
broken_sasl_auth_clients = yes                                                                                                                                             
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,check_client_access hash:/var/lib/pop-before-smtp/hosts,reject_unauth_destination               
smtp_use_tls = yes                                                                                                                                                         
smtpd_tls_auth_only = no                                                                                                                                                   
smtpd_tls_CAfile = /etc/postfix/cacert.pem                                                                                                                                 
smtpd_tls_loglevel = 1                                                                                                                                                     
smtpd_tls_received_header = yes

Open in new window

What does "nslookup <ip address of your server>" return?  That would be probably the best value to put into the myhostname field.

But if this server actually IS www.mydomain.com, then that is what you need to put in there.  What error did you get when you had that?

If you do "nslookup www.mydomain.com" does it return the IP address of that machine?
Avatar of starhu

ASKER

nslookup <ip address of your server>  :
 
Server:         213.133.98.98                                                   
 Address:        213.133.98.98#53                                                

 Non-authoritative answer:                                                       
 168.207.10.85.in-addr.arpa      name = static.85-10-207-168.clients.your-server.
 de.                                                                             

 Authoritative answers can be found from:                                        
 207.10.85.in-addr.arpa  nameserver = ns1.your-server.de.                        
 207.10.85.in-addr.arpa  nameserver = ns.second-ns.com.                          
 207.10.85.in-addr.arpa  nameserver = ns3.second-ns.de.

Open in new window


This is a virtual server if I know it well (my ip address is different). I set it to 213.133.98.98 then the error is:

 
root@Ubuntu-1004-lucid-64-minimal /etc/postfix # /etc/init.d/postfix restart                                                    
  * Stopping Postfix Mail Transport Agent postfix                                                                                
 postfix: warning: valid_hostname: numeric hostname: 213.133.98.98                                                               
 postfix: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter v                                                
 alue: 213.133.98.98

Open in new window

You need to use the actual hostname, not the IP address.  Set it to

myhostname=static.85-10-207-168.clients.your-server.de

Then it should work fine.
Avatar of starhu

ASKER

I set it exactly as follows: myhostname=static.85-10-207-168.clients.your-server.de

After restarting I don't get error messages, but I still don't get emails.

and if I try what you wrote:
 root@Ubuntu-1004-lucid-64-minimal /etc/postfix # sendmail -bv myaddress@gmail.com
 Mail Delivery Status Report will be mailed to <root>.                          
Okay, please look in /var/mail/root and find the message you just sent to myaddress@gmail.com (should be at the bottom of the file) and see what the bounce reason was...  there should be some lines that start with Diagnostic-Code.  Paste the error here?
Avatar of starhu

ASKER

The last email was on Jul 31:

 
From root@Ubuntu-1004-lucid-64-minimal  Sun Jul 31 06:25:06 2011                                                                                            
 Return-Path: <root@Ubuntu-1004-lucid-64-minimal>                                                                                                            
 X-Original-To: root                                                                                                                                         
 Delivered-To: root@Ubuntu-1004-lucid-64-minimal                                                                                                             
 Received: by Ubuntu-1004-lucid-64-minimal (Postfix, from userid 0)                                                                                          
 <------>id 3A3DE7E800D; Sun, 31 Jul 2011 06:25:06 +0200 (CEST)                                                                                              
 From: root@Ubuntu-1004-lucid-64-minimal (Cron Daemon)                                                                                                       
 To: root@Ubuntu-1004-lucid-64-minimal                                                                                                                       
 Subject: Cron <root@Ubuntu-1004-lucid-64-minimal> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )                               
 Content-Type: text/plain; charset=ANSI_X3.4-1968                                                                                                            
 X-Cron-Env: <SHELL=/bin/sh>                                                                                                                                 
 X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>                                                                             
 X-Cron-Env: <HOME=/root>                                                                                                                                    
 X-Cron-Env: <LOGNAME=root>                                                                                                                                  
 Message-Id: <20110731042506.3A3DE7E800D@Ubuntu-1004-lucid-64-minimal>                                                                                       
 Date: Sun, 31 Jul 2011 06:25:02 +0200 (CEST)                                                                                                                

 /etc/cron.daily/logrotate:                                                                                                                                  
 apache2: Could not reliably determine the server's fully qualified domain name, using 85.10.207.168 for ServerName

Open in new window

Are you sure?  The BOTTOM (or the end) of the file contains the newest messages - there's something very messed up if there hasn't been a single email in there since 7/31.

Do any other files appear in /var/mail?  What does "ls -l /var/mail" show?
Avatar of starhu

ASKER

Hello,

There is also a bestcom user (I suppose maybe a firewall because it is full of deny messages). This is full of messages. Last message:

 
From nobody@localhost  Wed Oct 26 19:27:28 2011                         
 Return-Path: <nobody@localhost>                                         
 X-Original-To: bestcom@localhost                                        
 Delivered-To: bestcom@localhost                                         
 Received: from [127.0.0.0] (localhost [127.0.0.1])                      
 <------>by static.85-10-207-168.client.your-server.de (Postfix) with ESM
 <------>for <bestcom@localhost>; Wed, 26 Oct 2011 19:27:28 +0200 (CEST) 
 From: DenyHosts <nobody@localhost>                                      
 To: bestcom@localhost                                                   
 Subject: DenyHosts Report                                               
 Date: Wed, 26 Oct 2011 19:27:28 +0200                                   
 Message-Id: <20111026172728.DB3F07E88BC@static.85-10-207-168.client.your

 Added the following hosts to /etc/hosts.deny:                           

 49.212.37.147 (www28353u.sakura.ne.jp)

Open in new window

Please set your script to use the address "expert@lsn.net" and then execute it.

I will check my own server logs on this end and see if I can tell why its being blocked.

Finally, I would also like you to run the following command from your Ubuntu server and paste the output here:


telnet gmail-smtp-in.l.google.com 25

Open in new window

Avatar of starhu

ASKER

You mean this: sendmail -bv expert@lsn.net  ? I did it.

and the other thing:
 
root@Ubuntu-1004-lucid-64-minimal /var/mail # telnet gmail-smtp-in.l.go
 gle.com 25                                                             
 Trying 74.125.39.27...                                                 
 Connected to gmail-smtp-in.l.google.com.                               
 Escape character is '^]'.                                              
 220 mx.google.com ESMTP s9si1606137fah.57

Open in new window

No, actually I meant for you to put expert@lsn.net in your original PHP form in place of your normal $to and then search your /var/log/mail.info and see what it says in there.

As far as the telnet command goes, I was just making sure you didn't have some kind of outbound firewall on port 25.  Obviously you can connect to Google's server on port 25, so you do not have anything blocking that, so that is good!  We're getting closer... I just need to see why the remote system is blocking the emails if they're actually going out of your system.  I also would like to know where the heck they are bouncing to, because they should be ending up in /var/mail, but we'll get to that.

Avatar of starhu

ASKER

I sent it.

The last page of log:

 
mail.info          [----]  0 L:[809+59 868/868] *(120135/120135b) <EOF>                                                                                                                                        
Oct 26 18:10:38 Ubuntu-1004-lucid-64-minimal postfix/bounce[31853]: B9B567E8ABB: sender delivery status notification: C4EC47E88BC                                                                              
Oct 26 18:10:38 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: B9B567E8ABB: removed                                                                                                                         
Oct 26 18:10:38 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: C4EC47E88BC: from=<>, size=2171, nrcpt=1 (queue active)                                                                                      
Oct 26 18:10:38 Ubuntu-1004-lucid-64-minimal postfix/error[31852]: C4EC47E88BC: to=<root@static.85-10-207-168.client.your-server.de>, relay=none, delay=0.03, delays=0.01/0/0/0.02, dsn=5.0.0, status=bounced (
Oct 26 18:10:38 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: C4EC47E88BC: removed                                                                                                                         
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/pickup[31845]: 263877E8ABB: uid=0 from=<root>                                                                                                             
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/cleanup[31849]: 263877E8ABB: message-id=<20111026161133.263877E8ABB@static.85-10-207-168.client.your-server.de>                                           
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 263877E8ABB: from=<root@static.85-10-207-168.client.your-server.de>, size=364, nrcpt=1 (queue active)                                        
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/error[31852]: 263877E8ABB: to=<starhu2@gmail.com>, relay=none, delay=0.02, delays=0.02/0/0/0, dsn=5.0.0, status=undeliverable (gmail.com)                 
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/cleanup[31849]: 29D347E88BC: message-id=<20111026161133.29D347E88BC@static.85-10-207-168.client.your-server.de>                                           
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/bounce[31854]: 263877E8ABB: sender delivery status notification: 29D347E88BC                                                                              
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 263877E8ABB: removed                                                                                                                         
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 29D347E88BC: from=<>, size=2170, nrcpt=1 (queue active)                                                                                      
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/error[31852]: 29D347E88BC: to=<root@static.85-10-207-168.client.your-server.de>, relay=none, delay=0.02, delays=0.01/0/0/0.01, dsn=5.0.0, status=bounced (
Oct 26 18:11:33 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 29D347E88BC: removed                                                                                                                         
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/smtpd[31994]: connect from localhost[127.0.0.1]                                                                                                           
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/smtpd[31994]: DB3F07E88BC: client=localhost[127.0.0.1]                                                                                                    
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/cleanup[31998]: DB3F07E88BC: message-id=<20111026172728.DB3F07E88BC@static.85-10-207-168.client.your-server.de>                                           
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: DB3F07E88BC: from=<nobody@localhost>, size=577, nrcpt=1 (queue active)                                                                       
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/smtpd[31994]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/local[31999]: DB3F07E88BC: to=<bestcom@localhost>, relay=local, delay=0.05, delays=0.02/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 26 19:27:28 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: DB3F07E88BC: removed                                                                                                                         
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/smtpd[32260]: connect from localhost[127.0.0.1]                                                                                                           
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/smtpd[32260]: 26ADB7E88BC: client=localhost[127.0.0.1]                                                                                                    
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32263]: 26ADB7E88BC: message-id=<20111026193009.26ADB7E88BC@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 26ADB7E88BC: from=<nobody@localhost>, size=580, nrcpt=1 (queue active)                                                                       
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/smtpd[32260]: disconnect from localhost[127.0.0.1]                                                                                                        
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/local[32264]: 26ADB7E88BC: to=<bestcom@localhost>, relay=local, delay=0.06, delays=0.03/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)           
Oct 26 21:30:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 26ADB7E88BC: removed                                                                                                                         
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/pickup[32242]: 09F6C7E8ACA: uid=0 from=<root>                                                                                                             
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32293]: 09F6C7E8ACA: message-id=<20111026194027.09F6C7E8ACA@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 09F6C7E8ACA: from=<root@static.85-10-207-168.client.your-server.de>, size=361, nrcpt=1 (queue active)                                        
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/error[32297]: 09F6C7E8ACA: to=<expert@lsn.net>, relay=none, delay=0.08, delays=0.06/0.01/0/0.02, dsn=5.0.0, status=undeliverable (lsn.net)                
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32293]: 166177E8ABB: message-id=<20111026194027.166177E8ABB@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/bounce[32298]: 09F6C7E8ACA: sender delivery status notification: 166177E8ABB                                                                              
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 09F6C7E8ACA: removed                                                                                                                         
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 166177E8ABB: from=<>, size=2157, nrcpt=1 (queue active)                                                                                      
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/error[32297]: 166177E8ABB: to=<root@static.85-10-207-168.client.your-server.de>, relay=none, delay=0.03, delays=0.01/0/0/0.02, dsn=5.0.0, status=bounced (
Oct 26 21:40:27 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 166177E8ABB: removed                                                                                                                         
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/pickup[32242]: 9EE877E8AE0: uid=33 from=<xx@xx.hu>                                                                                                        
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32312]: 9EE877E8AE0: message-id=<20111026195809.9EE877E8AE0@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 9EE877E8AE0: from=<xx@xx.hu>, size=484, nrcpt=1 (queue active)                                                                               
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/error[32316]: 9EE877E8AE0: to=<expert@lsn.net>, relay=none, delay=0.08, delays=0.06/0.01/0/0.01, dsn=5.0.0, status=bounced (lsn.net)                      
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32312]: AD6B27E8AE6: message-id=<20111026195809.AD6B27E8AE6@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: AD6B27E8AE6: from=<>, size=2406, nrcpt=1 (queue active)                                                                                      
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/bounce[32317]: 9EE877E8AE0: sender non-delivery notification: AD6B27E8AE6                                                                                 
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 9EE877E8AE0: removed                                                                                                                         
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/error[32316]: AD6B27E8AE6: to=<xx@xx.hu>, relay=none, delay=0.02, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (xx.hu)                                    
Oct 26 21:58:09 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: AD6B27E8AE6: removed                                                                                                                         
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/pickup[32242]: 078457E8AE0: uid=33 from=<expert@lsn.net>                                                                                                  
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32312]: 078457E8AE0: message-id=<20111026195829.078457E8AE0@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 078457E8AE0: from=<expert@lsn.net>, size=500, nrcpt=1 (queue active)                                                                         
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/error[32316]: 078457E8AE0: to=<expert@lsn.net>, relay=none, delay=0.03, delays=0.02/0/0/0.01, dsn=5.0.0, status=bounced (lsn.net)                         
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/cleanup[32312]: 0CB8E7E8AE6: message-id=<20111026195829.0CB8E7E8AE6@static.85-10-207-168.client.your-server.de>                                           
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/bounce[32318]: 078457E8AE0: sender non-delivery notification: 0CB8E7E8AE6                                                                                 
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 078457E8AE0: removed                                                                                                                         
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 0CB8E7E8AE6: from=<>, size=2440, nrcpt=1 (queue active)                                                                                      
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/error[32316]: 0CB8E7E8AE6: to=<expert@lsn.net>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (lsn.net)                            
Oct 26 21:58:29 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 0CB8E7E8AE6: removed

Open in new window

Okay, so your log file is lying - it never made it to my server to be bounced.  Let me think about this for a bit and get back to you.

The mail is definitely getting to postfix, but it's not leaving your server and I need to try to figure out why.
Speaking from experience, it is much less of a hassle to send email through another server than directly from your own.  If you have a Gmail account, I believe you can setup your server so basically the email comes from Gmail's servers, or send from your ISP's mail server.  This gets around issues with firewalls, configuring mail servers, DNS, and a whole slew of other potential problems.
Avatar of starhu

ASKER

crazedsanity: I have different domains on the server.
How this affect those? (every site should send email)
The mail server can really only send email as one domain (as far as I'm aware): it might be setup to be "mail.x.com", even though the domain "y.com" resides on the same server and wishes to send email directly from it.

I believe you can send email through the Gmail servers by configuring things correctly.  I have free Google Apps accounts that have domain mail setup.  The domains that have domain mail via Google can authenticate to the Gmail servers, thus avoiding the problems of trying to send email directly from the server itself.

It isn't the "easiest" solution, I'll grant you that, but mail servers are smarter nowadays.  Blocking messages from "bad hosts" before even processing them, rigorous SPAM filters, and a host of other things will all work against you.  Getting email sent from something that isn't a major email system isn't easy, nor should it be, thanks to all the spammers out there.
There's no such thing as "sending email as a domain".  There's no "domain" header in an email, and the receiving server only knows what IP the TCP connection originates from.  There are two headers which contain a configurable domain name - From: and Return-Path:   And guess what - they are no different than when you send snail mail - the Sender address on your envelope can be anything you want it to be, and so can whatever your return path/address is on an email.  Many servers on the remote end will do some sanity checks to make sure they are valid (so alien@outer.space will likely net you a bounce) but you can send mail through any server with any of the millions/billions of valid domain names out there as long as your IP address is authorized to send.

That being said, the author has what is probably a very simple Postfix configuration issue, but it's difficult for me to diagnose without being able to poke around the system.  Using a 3rd party host such as gmail is all fine and well, but it doesn't answer the question, and worse, the sysadmins then lose visibility as to what happens to subsequent mails, because all they can see is the handoff to the 3rd party relay.
@starhu

Please show me the following commands output:
hostname
domainname
cat /etc/hosts

Open in new window

Maybe my wording was a bit misleading.  The mailserver doesn't have a lot of choice as to how it appears to other mailservers, except the hostname that it gives to servers that it connects to, and the reverse DNS name of the connecting IP address.

For instance, if the mail server's IP address reverses to "static.ip-55555.isp.net", that's how other servers will interpret it.  If that mail server is configured to give the hostname "myserver.domain.local", that's what it will give out no matter what combination of to/from addresses are given.  Servers that receive these emails may bounce the message before even processing it due to the DNS mismatch.

Using a third party mail may obscure some pieces of the puzzle, but can definitely avoid the pitfalls of being blacklisted by other mail servers / ISPs, among other things.
As far as the email actually getting delivered: xterm, are you certain that your server didn't mark it as SPAM?  Or maybe your email client?  Check to see if starhu's server connected at all, if possible.
@crazedsanity:
100% positive that mail never touched my server, Postfix is bouncing them instantly internally, and I suspect it may have something to do with the system not knowing its own FQDN.
It would be *extremely* helpful to see the messages that are getting delivered to the server.  That may clear up this mystery completely...
Avatar of starhu

ASKER

xterm: The person who set up the server said that he forgot to put up the php-mail package but he has done it today.

Nevertheless I didn't get the email. I sent one for you as before, will you check it?

 root@Ubuntu-1004-lucid-64-minimal /var/www # hostname                          
 Ubuntu-1004-lucid-64-minimal

 root@Ubuntu-1004-lucid-64-minimal /var/www # domainname                        
 (none)

 root@Ubuntu-1004-lucid-64-minimal /var/www # cat /etc/hosts                    
 ### Hetzner Online AG installimage                                              
 # nameserver config                                                            
 # IPv4                                                                          
 127.0.0.1 localhost                                                            
 127.0.0.0 Ubuntu-1004-lucid-64-minimal                                          
 85.10.207.168 www.dorogikonyveloiroda.hu/ localhost                            
 #                                                                              
 # IPv6                                                                          
 ::1 ip6-localhost ip6-loopback                                                  
 fe00::0 ip6-localnet                                                            
 ff00::0 ip6-mcastprefix                                                        
 ff02::1 ip6-allnodes                                                            
 ff02::2 ip6-allrouters                                                          
 ff02::3 ip6-allhosts                                                            
Please remove the "/" from the line with your IP address in /etc/hosts.  Then issue command "hostname www.dorogikonyveloiroda.hu", and set that as your hostname in myhostname= in /etc/postfix/main.cf as well.

Then do "/etc/init.d/postfix restart" and let's try your web form again.
Avatar of starhu

ASKER

I did everything
And now what does /var/log/mail.info say when you attempt to send a message?  Is anything new appearing in /var/mail?
Avatar of starhu

ASKER

mail.info:

 
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/cleanup[4378]: 94F527E8AE0: message-id=<20111027175028.94F527E8AE0@static.85-10-207-168.client.your-server.de>                                            
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 94F527E8AE0: from=<>, size=2501, nrcpt=1 (queue active)                                                                                      
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/bounce[4383]: 89AC67E8898: sender non-delivery notification: 94F527E8AE0                                                                                  
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 89AC67E8898: removed                                                                                                                         
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/error[4382]: 94F527E8AE0: to=<starhu@egyediszoftverek.hu>, relay=none, delay=0.02, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (egyediszoftverek.hu)     
Oct 27 19:50:28 Ubuntu-1004-lucid-64-minimal postfix/qmgr[31846]: 94F527E8AE0: removed                                                                                                                         
Oct 27 20:09:05 Ubuntu-1004-lucid-64-minimal postfix/master[31843]: terminating on signal 15                                                                                                                   
Oct 27 20:09:05 Ubuntu-1004-lucid-64-minimal postfix/master[4587]: daemon started -- version 2.7.0, configuration /etc/postfix                                                                                 
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/pickup[4589]: A8F137E8898: uid=33 from=<starhu@egyediszoftverek.hu>                                                                                       
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/cleanup[4594]: A8F137E8898: message-id=<20111027180925.A8F137E8898@www.dorogikonyveloiroda.hu>                                                            
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: A8F137E8898: from=<starhu@egyediszoftverek.hu>, size=493, nrcpt=1 (queue active)                                                              
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/error[4597]: A8F137E8898: to=<expert@lsn.net>, relay=none, delay=0.09, delays=0.06/0.01/0/0.02, dsn=5.0.0, status=bounced (lsn.net)                       
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/cleanup[4594]: B5F777E8AE0: message-id=<20111027180925.B5F777E8AE0@www.dorogikonyveloiroda.hu>                                                            
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: B5F777E8AE0: from=<>, size=2309, nrcpt=1 (queue active)                                                                                       
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/bounce[4598]: A8F137E8898: sender non-delivery notification: B5F777E8AE0                                                                                  
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: A8F137E8898: removed                                                                                                                          
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/error[4597]: B5F777E8AE0: to=<starhu@egyediszoftverek.hu>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (egyediszoftverek.hu)     
Oct 27 20:09:25 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: B5F777E8AE0: removed                                                                                                                          
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/pickup[4589]: 1CB367E8898: uid=33 from=<www-data>                                                                                                         
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/cleanup[4594]: 1CB367E8898: message-id=<20111027180936.1CB367E8898@www.dorogikonyveloiroda.hu>                                                            
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: 1CB367E8898: from=<www-data@www.dorogikonyveloiroda.hu>, size=408, nrcpt=1 (queue active)                                                     
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/error[4597]: 1CB367E8898: to=<csillag.zsolt@egyediszoftverek.hu>, relay=none, delay=0.03, delays=0.02/0/0/0.01, dsn=5.0.0, status=bounced (egyediszoftvere
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/cleanup[4594]: 221C37E8AE0: message-id=<20111027180936.221C37E8AE0@www.dorogikonyveloiroda.hu>                                                            
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/bounce[4599]: 1CB367E8898: sender non-delivery notification: 221C37E8AE0                                                                                  
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: 1CB367E8898: removed                                                                                                                          
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: 221C37E8AE0: from=<>, size=2313, nrcpt=1 (queue active)                                                                                       
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/error[4597]: 221C37E8AE0: to=<www-data@www.dorogikonyveloiroda.hu>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.0.0, status=bounced (www.dorogikonyve
Oct 27 20:09:36 Ubuntu-1004-lucid-64-minimal postfix/qmgr[4590]: 221C37E8AE0: removed

Open in new window



The /var/mail/root is like yesterday: the last entry was in July
Please put "www-data     root" into /etc/aliases, and then do "newaliases"

Then send the mail again, and see if the bounce goes to root.  At least right now from the log I can see that your hostname is correct in the outgoing mails, so we're making some progress.
Avatar of starhu

ASKER

I did it.
The /var/mail/root  didn't change
Alright, let me think on it some more.  This one is really tough.  I wish I could log in there and take a look.  If you want me to do so, you can mail me login details at the email address I gave you.
Avatar of starhu

ASKER

I will mail it in a minute
ASKER CERTIFIED SOLUTION
Avatar of xterm
xterm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial