Solved

Configure Postfix SMTP on a co-location server

Posted on 2007-12-07
8
1,010 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
  • 4
  • 3
8 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
Comment Utility
0
 
LVL 14

Expert Comment

by:arrkerr1024
Comment Utility
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
Comment Utility
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
 

Author Comment

by:mrgordonz
Comment Utility
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
Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
mynetworks_style = subnet
local_recipient_maps =
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now