I am attempting to configure an openSuse 11.1 box to send outgoing email for a domain that the same server is hosting. I don't understand enough about smtp servers and the like to know what needs to be in place and working.
The system already had Postfix installed, and I confirmed it was running via a
> sudo /etc/init.d/postfix status
I examined the Postfix config file in /etc/main.cf and configured a couple of items regarding the domain/host name and such, but left it largely default.
I attempted to send an email from the command line with the following command:
> echo "test 123" | mail -s "test subject" [email protected]
Where differentdomain.com was not the same domain as the one best hosted on the server. However, the email never reaches the target account.
Any suggestions?
EDIT:
In the postfix log, (/var/log/mail.info, there's nothing in .err) I see that postfix is trying to connect to what appears to be a different smtp server on our network, with a connection refused:
connect to ourdomain.com.inbound15.mxlogic.net[our ip address]:25: Connection refused
However, I can't figure out why it is 1) trying to connect to that server and 2) not just sending the messages itself... I mean, isn't postfix an smtp server?
I did a grep -ri on ourdomain from /etc and see no configuration files anywhere telling it to do this. Why is it?
I found this link helpful when configuring Postfix:
http://www.postfix.org/STANDARD_CONFIGURATION_README.html
The "postconf -n" tip was particularly useful in uncovering items configured, then reconfigured later in main.cf
Start with /var/log/mail as Postfix will log pretty much everything.
It looks like Postfix is looking up the MX record for differentdomain.com, which is ourdomain.com.inbound15.mxlogic.net, and attempting to connect to port 25 of that mail server to send out the email. Does your ISP allow outgoing connections to port 25? Do you have outbound connections to Port 25 blocked in a firewall?
Your outgoing messages aren't going through postfix at all when you send by the command line. To answer the question in the subject - you don't need very much in place to send messages from a linux box. You don't need Postfix just to send mail.
The
mail
programme will try and send directly to the smtp server listed in the MX record for the domain you send to. Mind you - that smtp server might not allow you to send directly to it in this way. As llandar says your firewall may be blocking the outgoing traffic. You need to check your (probably) iptables setup by runningThat will list your active firewall rules (if you are running iptables) including open ports.
Then I guess what you are really trying to do is test whether your postfix setup is working - you need to try and make a manual smtp connection to it. I wrote about this in answer to another question. The output of that, and the contents of the logfile Hutch mentioned (may also be called /var/log/maillog) will help you understand the health of your Postfix config.
I strongly recommend The Book of Postfix if you will be working with postfix a lot. A great manual which steps you through all the aspects of configuration in lots of scenarios, and gives you a good understanding of how mail servers work.
Whenever I come across a problem like this (which could seemingly be caused by dns, postfix, command clients, etc)-- the first thing I try to do is eliminate possibilities. In your example, I would start by eliminating postfix issues by two things:
1) grep for various parts of the servername that is being connected to (using the examples from your log file and email attempts):
2) test outgoing email delivery with more than one example. If trying to send to a google, yahoo, and differentdomain.com address all result in attempts to delivery to the mxlogic.net address, I would suspect any of the following: - You have a smarthost configured and it's just not reachable - Something in the configuration is telling postgres to always append "inbound15.mxlogic.net" to every outgoing email address
Take a look at the output of 'mailq' -- are the email addresses it's trying to deliver to what you expected?
Go to http://www.mxlogic.com/postmaster/bouncetypes/connect_refused.cfm and have your IP address de-listed. Domains that use mxlogic.net for mail routing are protected by a firewall.