This guide is especially useful for Oracle E-Business Suite/application servers running on Solaris that rely on Sendmail for outbound notifications.
Prerequisites
Solaris OS with Sendmail installed
Root or equivalent privileges
Access to corporate mail relay/server
Step 1: Stop the Sendmail Service
Before making any configuration changes, stop the Sendmail service to avoid conflicts.
svcadm disable -t network/smtp:sendmail
Step 2: Verify Sendmail Service Status
Confirm that the service is stopped.
svcs -a network/smtp:sendmail
The status should indicate disabled or maintenance.
Step 3: Backup Existing Configuration Files
Always take a backup before modifying Sendmail configuration files.
Navigate to the Sendmail configuration directory:
cd /etc/mail/cf/cf
Create a copy of the existing sendmail.mc file using the hostname:
cp sendmail.mc `uname -n`.mc
This ensures you can easily identify the configuration per host.
Step 4: Edit the New Configuration File
Edit the newly created .mc file:
vi `uname -n`.mc
Add the following line to configure masquerading:
define(`SMARTHOST', `mail.server-mycompany.co.in')dnl
Note: Replace
mail.server-mycompany.co.inwith your actual corporate mail server or domain name.
This setting ensures that outgoing emails appear to originate from the specified mail domain instead of the local server hostname.
Step 5: Build the Sendmail Configuration File
Use m4 to generate the .cf file from the .mc file:
make `uname -n`.cf
This command converts the macro configuration into a Sendmail-readable format.Add the mail server name in the configuration filevi `uname -n`.cf# "Smart" relay host (may be null)
DSmail.server-mycompany.co.inStep 6: Install the New Configuration File
First, back up the existing production configuration:
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.`date +%d-%b-%Y-%H-%M`
Now, replace it with the newly generated configuration:
cp `uname -n`.cf /etc/mail/sendmail.cf
Step 7: Restart the Sendmail Service
Enable and start the Sendmail service:
svcadm enable network/smtp:sendmail
Verify the service status again if needed:
svcs network/smtp:sendmail
Step 8: Send a Test Email
Use mailx to send a basic test email:
mailx -s "Test Mail" -v jxxx@yyyy.zzz < /dev/nullConfirm that the recipient receives the email and that the From address shows the masqueraded domain.
Step 9: Test Mail Server Connectivity
Validate SMTP connectivity to the mail server:
telnet mailserver.com 25
A successful connection indicates that the server can reach the mail relay on port 25.
Conclusion
By configuring Sendmail , you ensure consistent and compliant outbound email delivery from Solaris servers. This setup is critical in enterprise environments where mail policies require all applications and servers to send emails through an approved mail domain.
Following these steps also minimizes downtime and allows safe testing before applying changes to production.
No comments:
Post a Comment