[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Sendmail config

Posted on 2006-06-09
Medium Priority
Last Modified: 2013-12-21
We run Exchange internally for email and have a Solaris server that runs our main systems
We have Sendmail configured enough that we can send email from the Sun server to internal users, but cannot send outside of our network.
Our email domain is @harlemfurniture.com, our Solaris logs show the email coming from  @harlem.harlem.com...?
Where do I need to look to correct the @harlem.com to @harlemfurniture.com?
Question by:harlemit
  • 2
  • 2
  • 2
LVL 38

Expert Comment

ID: 16883067
what's the domainname setting for your Solaris box? type in:


to find out.

Do you have a mailserver already up and runing? (it can be used as a mail samrt

And you also need to check the followings for your Solaris box:

1) DNS settings:
    Check the following files in your Solaris box:
    a) edit you /etc/resolv.conf file, to put your DNS server ip in, the file looks like:
        nameserver your-isp-dnsserver-ip
    b) make sure that the hosts record in  /etc/nsswitch.conf  file looks like:
        hosts:     files dns [NOTFOUND=continue]

2) check your sendmail configuration file (/etc/mail/sendmail.cf)
     check if the smart hosts is defined:
it should looks like:

# "Smart" relay host (may be null)

You can use your ISP's mail server as the Smart relay hosts.
if your ISP's mailhost name is fred.abc.com, you can do:

3) If you want the Solaris box as a real mail server (can send and received email
    from the outside of the world, you need to setupDNS  MX record for the  
    Solaris box:
   Check the DNS to see if your mail server has MX record:
nslookup -type=MX you-machine-name
man nslookup

If you are not runing a DNS server, you need to ask your ISP you add the DNS record with
MX for your box.

   If your domain name is harlem.com  for the sunbox, and you want to make the
Solaris can received mails for box harlem.com   and harlemfurniture.com

    you need to make sure sendmail.cf has something like:
#   local info   #

# Cwlocalhost
Cwlocalhost harlem.com   harlemfurniture.com

   Note: you need to remember to restart sendmail after you modify the sendmail.cf file.

   EE has a sendmail TA, for sendmail question, it is better to post it in:

 also please read the following sendmail FAQ and tips:


Expert Comment

ID: 16895090
To change from @harlem.com to @harlemfurniture.com, this could be done by the process called masquerading. If you go through the available sendmail docs for masqurading howto, you should be able to figure out how to do it.

Author Comment

ID: 16898194
We are getting close.
We do have internal DNS and a separate SMTP server.

When I try 'domainname' I get no response?

It does not appear that my email are being forwarded to my SMTP server though.
In the logs it shows that yahoo is rejecting my mail sent from this server rather than our SMTP server.
What do I need to do to ensure that sendmail routes this email through our SMTP server?

I found an entry in the sendmail.cf file:

# my official domain name
# ... define this only if sendmail cannot automatically determine your domain

The Dj$w.harlem.com was the original entry, we would then get a denial stating our from domain was harlem.harlem.com.
After changing this record to the Dj$w.harlemfurniture.com, the denial now states that the from domain is harlem.harlemfurniture.com.

BTW, harlem is the name of the server, so I am reading this as it is sending this email from itself rather than through our internal SMTP server which has a legit MX record.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 16898343
More info,
When sending an email with this:

# my official domain name
# ... define this only if sendmail cannot automatically determine your domain

Included in our sendmail.cf file, the email shows up as coming from Super-User@localhost and from the server harlem.harlemfurniture.com

If I remove this line, then the email looks better formatted coming from Super-User@harlem.com and from the server harlem.com.

Now, where does sendmail determine it's domain?
I need to change it from harlem.com to harlemfurniture.com
LVL 38

Assisted Solution

yuzh earned 1000 total points
ID: 16899151
>When I try 'domainname' I get no response?

you need to set the domain for your box, login as root or su as root, use a text
editor (eg vi, dtpad) to edit (or create) /etc/defaultdomain file
and put your domainname inside the file, eg


also edit /etc/hosts file to  add the full name in the  file, eg:
xxx.xxx.xx.x mybox loghost

you can also coment out:

in sendmail.cf file

xxx.xxx.xx.x mybox.harlemfurniture.com    mybox loghost

where: xxx.xxx.xx.x is the IP of your box, and mybox is your hostname.

then reboot the system.

Accepted Solution

z670193 earned 1000 total points
ID: 16902718
Hi harlemit,

I don't know what version of sendmail you are working with, but the below steps should resolve one of the issues that you are having. To change from @harlem.harlemfurniture.com to @harlemfurniture.com -- as I had already mentioned -- you would have to follow the steps for masquerading. Below are the steps to do so.

Configuring the Solaris-supplied version of Sendmail
In this example, I will configure the version of Sendmail (8.11.7) that was installed by default on a Solaris 8 system. Sendmail will be configured to use header sender and envelope sender address masquerading and a "smart host."

On Solaris 9, substitute main.mc for main-v7sun.mc in the instructions.

1. Change to the directory containing the Sendmail configuration files.
cd /usr/lib/mail/cf

2. Make a copy of main-v7sun.mc as sendmail.mc, and make modifications to sendmail.mc.
cp main-v7sun.mc sendmail.mc

3. Configure sendmail.mc. In this example, we want to use the "smart host" smart_host.example.com and masquerade both the header sender and envelope sender addresses as example.com.

vi sendmail.mc

Insert the following entries before the MAILER lines:

define(`SMART_HOST', `smart_host.example.com')

4. Build the sendmail.cf file from the sendmail.mc file.
# /usr/ccs/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf

5. Test the sendmail.cf file.
/usr/lib/sendmail -bt -C./sendmail.cf

Make sure that root is an "exposed user." An exposed user is a user that will not be masqueraded. This is used when accounts, such as root, are not unique across systems.

> $=E

Test header sender and envelope sender masquerading:
> /tryflags HS
> /try esmtp user@host.example.com
Rcode = 0, addr = user@example.com

> /tryflags ES
> /try esmtp user@host.example.com
Rcode = 0, addr = user@example.com

6. Backup the existing sendmail.cf file.
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.date

7. Install the new sendmail.cf file.
cp sendmail.cf /etc/mail/sendmail.cf

8. Sendmail the Sendmail process a SIGHUP to begin using the new configuration file.
kill -HUP `head -1 /var/run/sendmail.pid`


As far as sending mails through smtp server, you would have to check if the mail is relaying through the SMTP server properly. If the yahoo header is indicating that your email messages are being rejected is because of the box you are working on -- most probably it is not relaying properly via the SMTP server. Please check configuration files on relaying...

If you could mention the steps that you had taken to configure relaying your outgoing messages, probably we could help.

Hopefully this helps.. Cheers!!

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month19 days, 2 hours left to enroll

834 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