I installed a sendmail relay server in my LAN so that other servers can use it to send emails. The following is how I did the configuration in a Ubuntu 9 machine.
1. First you need to install sendmail package.
2. After installation, you need to do the following configuration:
(1) Sendmail Master Configuration File: /etc/mail/sendmail.mc
# vi sendmail.mc
To enable relay on a specific IP, you need to change SMTP Daemon's IP address. By default, it is 127.0.0.1 which is your localhost loopback address. This setting only allows you to send email from localhost. If you want other servers to use this server as relay to send emails, you much change to a valid IP address in your LAN, for example, it can be 192.168.0.88. In order to do so, you need to change the line 57 and 59 to as below:
DAEMON_OPTIONS('Family=inet, Name=MTA-v4, Port=smtp, Addr=192.168.0.88')dnl
DAEMON_OPTIONS('Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=192.168.0.88')dnl
Please replace 192.168.0.88 with your real IP address. You also need to change following two lines at 100 and 104:
Next step, you need to compile the sendmail.mc file to sendmail.cf file which will be actually used by sendmail. You need to type:
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
You need to restart the sendmail server to make the change effective:
# /etc/init.d/sendmail restart
To check if the Sendmail is listening on an IP and a specific port, you can type:
# netstat -aunt
To check if the SMTP Port is open and listening from another server, you can type:
# nmap -v -sT 192.168.10.10 (IP address of this SMTP server)
(2) Configure the Access Control file: /etc/mail/access
# vi access
If you want to allow 192.168.0.99 to relay, add the following line:
You also need to compile the access file to access.db file.
# makemap hash /etc/mail/access.db < /etc/mail/access
You need to restart the sendmail service to make it effective.
3. Sendmail Troubleshooting
If the local domain emails can not be delivered, and if your email service is hosted by an outside ISP, like Gmail (Google App.), please make sure your DNS setting will let you to resolve the correct MX record. Usually, you can set the external DNS server as your DNS server.
# vi /etc/resolv.conf
You need to replace 126.96.36.199 with your real DNS Server's IP address provided by your ISP.
The Hostid is a globally unique ID for a Sun Solaris Machine. Sometimes, you need to change this hostid for whatever purpose. For example, you current machine is down for hardware failure and you purchased a new machine. However, all your current running software are based on this old hostid, and you must bring the new machine up within a very short time. The quick solution is to change the new machine's hostid to be as same as the old one.
There are several ways to do so, including using a program to flush NVRAM which will change the hostid permanently. I did following experiment to change the Hostid in a Solaris 10 machine temperately. It adds several lines in the /etc/rc2.d/S20sysetup file. If you want to restore the original hostid, you just need to remove these lines and reboot the machine.
My environment is:
# uname -a
SunOS myhostname 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5120
Step 1: Calculate your new Hostid
(1) If you want to change your hostid to 800a1b2c (hexdecimal format), you need to calculate its decimal first. You can use following online calculator to do this.
(2) Then, divide the decimal number to three parts:
(3) You treat the above 3 parts as string combined by ASCII Characters. Use following calculator to get the HEX value:
32 31 34 38
31 34 35 39
You need to pad 0s to the 3rd part. So it will become:
Step 2: Save your original Hostid:
cat hostid > hostid.orig
Step 3: Change the /etc/rc2.d/S20sysetup file
At the bottom of this file, add following code:
# Change Host ID to Hexdecimal: 800a1b2c
# It's Decimal Value: 2148145964
# Divide to 3 parts: 2148 1459 64
# Hex value of the above ASCII Characters:
# 32 31 34 38
# 31 34 35 39
# 36 34
# After padding:
# The following code will apply the new Hostid
adb -w -k /dev/ksyms /dev/mem </dev/null
Step 4: If you want to make the new hostid effective without reboot the machine, just type:
Otherwise, you can reboot the machine. If you want restore the original factory hostid, you can just comment out the above several lines of code in S20sysetup file.
As an .NET application developer, the following 9 websites are my most frequently visited websites.
I learned .NET and get a lot of resources from this website.
MSDN's primary web presence at msdn.microsoft.com is a collection of sites for the developer community that provide information, documentation, and discussion which is authored both by Microsoft and by the community at large. Recent emphasis on and incorporation of applications such as forums, blogs, library annotations, and social bookmarking are changing the nature of the MSDN site from a one-way information service to an open dialog between Microsoft and the developer community.
I downloaded many source code from this website. There are also many very good articles.
8. Chanel 9
Many videos introducing very cool and latest Microsoft technologies.
9. ScottGu's Glog
The About Me Page of this blog:
My name is Scott Guthrie, and I am a Corporate Vice President in the Microsoft Developer Division. I run the development teams that build the following products/technologies:
* CLR and the core .NET Base Class Libraries
* IIS 7.0
* Visual Studio Tools for ASP.NET, WPF, Silverlight and Mobile