Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Configure Postfix SMTP on a co-location server

Posted on 2007-12-07
8
Medium Priority
?
1,026 Views
Last Modified: 2013-12-16
Hi Experts,

I have just recently placed a server in a co-location data centre. The server is running Ubuntu Server 6.06 LTS. In addition, I have installed VMware server and created a few virtual machines.  That side of things is working nicely (many thanks to WizRd-Linux).

On the VMs I have installed an application (a J2EE web application) which needs to be able to send emails to users. As part of the application config I need to specify the SMTP server which will be used for relaying emails. This is normally not an issue because the application is most often installed on customer sites (behind the firewall) and we just specify their SMTP server, and Bob's your uncle.

But in the co-location facility I need to setup my own SMTP server (the co-lo people said they don't normally give access to an SMTP server for co-lo customers).

I followed the instructions on this site: http://my.opera.com/Contrid/blog/show.dml/478684 to set up Postfix - it was pretty easy and seemed to install OK.

But it won't work . I know that Postfix is running cos when I do a

netstat -l

I can see that something is listening on port 25 and from the VMs I can telnet to the host on port 25.

But the mail is bouncing for some reason, as can be seen from this snippet from the mail.info log file:

Dec  7 17:09:56 ozsabasvr01 postfix/smtpd[10931]: connect from unknown[10.28.101.11]
Dec  7 17:09:56 ozsabasvr01 postfix/smtpd[10931]: B0658398050: client=unknown[10.28.101.11]
Dec  7 17:09:56 ozsabasvr01 postfix/cleanup[10935]: B0658398050: message-id=<1989174.1197011396750.JavaMail.SYSTEM@ozsabavm01>
Dec  7 17:09:56 ozsabasvr01 postfix/qmgr[10867]: B0658398050: from=<lmsadmin@some.domain.com>, size=549, nrcpt=1 (queue active)
Dec  7 17:09:56 ozsabasvr01 postfix/smtpd[10931]: disconnect from unknown[10.28.101.11]
Dec  7 17:09:56 ozsabasvr01 postfix/local[10936]: B0658398050: to=<paul.hobbs@some.domain.com>, relay=local, delay=0, status=bounced (unknown user: "paul.hobbs")
Dec  7 17:09:56 ozsabasvr01 postfix/cleanup[10935]: D166E398054: message-id=<20071207070956.D166E398054@vmhost.adomain.com>
Dec  7 17:09:56 ozsabasvr01 postfix/qmgr[10867]: D166E398054: from=<>, size=2211, nrcpt=1 (queue active)
Dec  7 17:09:56 ozsabasvr01 postfix/qmgr[10867]: B0658398050: removed
Dec  7 17:09:56 ozsabasvr01 postfix/local[10936]: D166E398054: to=<lmsadmin@some.domain.com>, relay=local, delay=0, status=bounced (unknown user: "lmsadmin")
Dec  7 17:09:56 ozsabasvr01 postfix/qmgr[10867]: D166E398054: removed


Why is the log saying unknown user: "paul.hobbs"?  Where is this user supposed to be defined?  It is inconceivable to me that an SMTP server would need to have knowledge of the recipient of an email.

I have never configured an SMTP server, and my knowledge of Linux is limited.
0
Comment
Question by:mrgordonz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 2000 total points
ID: 20427187
0
 
LVL 14

Expert Comment

by:arrkerr1024
ID: 20430915
Are you just trying to configure an outgoing-only email server. or do you want to receive incoming emails as well?  If you just want the application to be able to send outgoing then most linux distros come with a lightweight smtp server configuration that works out of the box.  You really only need to go to the trouble to configure postfix or qmail or anything big if you want to receive incoming mail as well.  To use your local machine you just set the smtp server in your application to use "localhost".

The paul.hobbs is where the email is going TO, so you don't need to do anything - on the remote end there isn't a user called paul.hobbs.
0
 

Author Comment

by:mrgordonz
ID: 20431813
Yep - that is exactly right - I just want to send emails.  I don't want to receive any email and I am not setting up any mail boxes.

So, how does the application which is running in the VM use the lightweight SMTP server on the host?  The VM is Windows Server 2003 and the Host is Ubuntu Server 6.06 (Dapper Drake).

Ideally I would like to use Postfix because it seems to be one of the more widely used mail servers.  At the moment I don't need to receive emails, but it is quite possible that will change at some point in the future.

The host server has several interfaces, including a custom VMware interface (vmnet2):

vmnet2    Link encap:Ethernet  HWaddr 00:50:56:C0:00:02
          inet addr:10.28.101.1  Bcast:10.28.101.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:129481 errors:0 dropped:0 overruns:0 frame:0
          TX packets:109898 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

All the VMs that are running on the host have a static IP in the range 10.28.101.10-99.

Below is a snippet from /etc/postfix/main.cf:

myhostname = vmhost.ozsaba.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mynetworks_style = subnet
#mynetworks = 127.0.0.0/8, 10.28.101.0/24
mailbox_size_limit = 0
recipient_delimiter = +
local_recipient_maps =
mydestination = ozsaba.com

From my reading of the Postfix doco, by making the mynetworks_style parameter = subnet, Postfix should forward mail from clients in authorized network blocks to any destination.  But there is every chance I am not interpreting the doco correctly.

My end goal here is the have the SMTP server send emails to any email address (eg: fred.bloggs@gmail.com, jimmy1234@somedomain.com, etc), but only act as a relay for the applications running on the VMs (all of which have private IP addresses).

Cheers,

Paul
0
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 

Author Comment

by:mrgordonz
ID: 20438438
I have noticed that if I send an email to <recipient1>@ozsaba.com, the mail is delivered OK, but if I send an email to <recipient2>@ozsaba.com, it bounces.  The difference between <recipient1> and <recipient2> is that <recipient1> is also a user on the Linux server, whereas <recipient2> is not.  This makes me think that Postfix is only delivering locally, and that is not actually sending emails "out" to the Internet.


In the main.cf file, the myorigin parameter is set to /etc/mailname

The contents of /etc/mailname is:

ozsaba.com

Should I put something else in this file?

Cheers,

Paul
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20440119
Hi,

What do you mean by

"he difference between <recipient1> and <recipient2> is that <recipient1> is also a user on the Linux server, whereas <recipient2> is not."

I think if username does not exits under the domain then it will not send out messages.

Where the message bounces back to?

Did you try to send to the Internet and it failed to?
0
 

Author Comment

by:mrgordonz
ID: 20440543
From the web application that is running on the VM, I triggered two emails.  One was sent to the address:

<recipient1>@ozsaba.com

The second email was sent to

<recipient2>@ozsaba.com

I have masked the real recipients because I don't want to share the login name of one of the users on my server.  But as an example, let's say that <recipient1> is john.brown, and <recipent2> is jbrown.  The two emails were sent to:

john.brown@ozsaba.com and
jbrown@ozsaba.com

The mail boxes for ozsaba.com are not hosted on this server - they are hosted elsewhere.  But, the email to john.brown did not bounce, while the email to jbrown did bounce.  The only difference was that john.brown has an account on the Linux server, while jbrown doesn't.  Interestingly, there are mail boxes on this server (I assume this is normal behaviour for Postfix), and the email to john.brown ended up in one of those mail boxes.  However, what seemed to be happening is that Postfix was trying to deliver the emails only locally.  After I did a force-reload, after I changed the main.cf file, I noticed that the log file now showed it was delivering emails to the Internet.

I hope that all makes sense.

Note:  john.brown and jbrown are not real login names or email addresses - I just used them to illustrate the scenario.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20440576

Don't worry I will not try to figure out the real mail addresses :)

So what changes were made to main.cf ?
0
 

Author Comment

by:mrgordonz
ID: 20440589
mynetworks_style = subnet
local_recipient_maps =
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question