Postfix not sending mail

Hello,

I have a virtualmin server on CentOS 6.3 (Final).
The domain’s email is hosted by Google so I don’t need to host email. However, the domain is a PHP domain that needs to send alert emails.

Don’t want to bore you with the script, but this is the command code:

echo mail(‘test@gmail.com’, ‘My Subject’, $message,$headers) or die(‘boo’);

And email doesn’t go out.
So, I used my own syntax from the bash prompt:

mail -s “Test” test@gmail.com
.

And I see the following error in maillog:
Nov 20 05:11:35 dev postfix/pickup[9113]: B2F04DF85: uid=502 from=
Nov 20 05:11:35 dev postfix/cleanup[9576]: B2F04DF85: message-id=20121120101135.B2F04DF85@dev.hostname.com
Nov 20 05:11:35 dev postfix/qmgr[9114]: B2F04DF85: from=virtualdomain@dev.hostname.com, size=438, nrcpt=1 (queue active)
Nov 20 05:11:35 dev postfix/error[9578]: B2F04DF85: to=test@hostname.com, relay=none, delay=0.12, delays=0.08/0.01/0/0.03, dsn=5.0.0, status=bounced (User unknown in virtual alias table)
Nov 20 05:11:35 dev postfix/cleanup[9576]: C74AADF8B: message-id=20121120101135.C74AADF8B@dev.hostname.com
Nov 20 05:11:35 dev postfix/bounce[9579]: B2F04DF85: sender non-delivery notification: C74AADF8B
Nov 20 05:11:35 dev postfix/qmgr[9114]: C74AADF8B: from=<>, size=2210, nrcpt=1 (queue active)
Nov 20 05:11:35 dev postfix/qmgr[9114]: B2F04DF85: removed
Nov 20 05:11:36 dev postfix/local[9580]: C74AADF8B: to=virtualdomain@dev.hostname.com, relay=local, delay=0.38, delays=0.02/0.01/0/0.34, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME)
Nov 20 05:11:36 dev postfix/qmgr[9114]: C74AADF8B: removed

main.cf has the hostname as dev.hostname.com

Please help!
Thanks!

Oh, and during the script being tested “Mail for domain” was enabled. But I read somewhere on the forum that it needs to be enabled to handle inbound mail. So, I disabled “Mail for domain”. Restarted postfix manually on the server as well. Nogo.

Howdy,

Hmm, did you send that message to “test@gmail.com”, or “test@hostname.com”?

It looks as if it’s trying to deliver to “test@hostname.com”.

But yeah, as you mentioned – the Mail for Domain feature would need to be disabled for any Virtual Server that isn’t hosting email locally.

The same goes for DNS – if you’re not using your server as a nameserver, you would want to disable the “DNS Domain” feature.

If you are using your server as a nameserver, you’d want to make sure that the MX records are setup to point to your actual mail server, rather than your Virtualmin server.

-Eric

Sending it to test@gmail.com and I see it’s sending it to test@hostname.com, don’t know why…

Any suggestions?

“Hostname” is a placeholder for the hostname of your server?

If Postfix changes the destination host like that, there has to be some kind of rewrite/redirect configured in Postfix. I don’t know its intricacies well enough to say “it must be there or there”. So you might want to go through its configuration, either in Webmin’s GUI, or by grepping for “hostname.com” in all files in /etc/postfix, to see if there is any kind of mapping that might cause this redirection.

Yes, hostname is a fictitious name for the real hostname I have on our server, for privacy reasons.

Okay, did you check your Postfix config like I suggested? grep "yourhostname" /etc/postfix/* should turn up something.

It’s in main.cf as:

mydestination = $myhostname, localhost.$mydomain, localhost,