Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Sendmail woes on Solaris 8

Posted on 2001-07-02
Medium Priority
Last Modified: 2013-12-21
I can't figure out how to get Sendmail to work properly by calling it from programs.

And (I apologize for my ignorance here), I can't figure out how to send an email to another box on the same subnet with either mail or mailx (I tried to install pine, but it was rough going).  A few weeks ago I was able to get mail (something about keeping the msg on the same line and using ctrl-d) and mailx working, but I forgot how I did it :(

I'm pretty sure it'll send mail to another comp on the same subnet (i.e. rich@  But, I never got it working to send to the outside world: richard@domain-name.com.  I think this is my big problem.

I don't know if it's because of DNS or what...  Here's how my DNS is setup:

I configured client side DNS on this box like this (since I don't have a registered domain name for it):

I added the file /etc/resolv.conf
editted /etc/nsswitch.conf

And I can get the DNS to work for things such as ping and web surfing.


If I can get a local Sendmail to send to the outside world, that would be great.  When I set my smtpHost in a Java program to localhost, here's the error (I don't know why it loops, but it works fine on a Linux box):

Here is the report:This is the content of the report
the to email addy is:richyz26@hotmail.com
Mail sent to: richyz26@hotmail.com
the to email addy is:richyz26@hotmail.com
Mail sent to: richyz26@hotmail.com
the to email addy is:null
javax.mail.SendFailedException: Sending failed;
  nested exception is:
        javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
        javax.mail.SendFailedException: 550 <null>... User unknown

I also tried to have it use a remote smtpServer (on the same subnet), but that isn't working either:

javax.mail.SendFailedException: Sending failed;
  nested exception is:
        javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
        javax.mail.SendFailedException: 450 4.7.1 <richyz26@hotmail.com>... Relaying temporarily denied. Cannot resolve PTR record for (this isn't my real ip, the security on the box is pretty loose tho).

If anyone can help me get through this last configuration problem, I would be ecstatic!  I just want this box to be able to send email to the outside world without having a registered domain name for it's IP address.  I'll throw in another 25-75 points depending on how detailed the help is for this Solaris NewB.

Thx :)

Question by:richyz26

Expert Comment

ID: 6249119
try using

/usr/lib/sendmail -v xxx@yyy.com

then enter something and finish wit ctrl-D

that should give you some information about what is happening with your mail.
LVL 40

Expert Comment

ID: 6250890
This is a case where you should be using a SMART_HOST that is part of a registered domain for non-local mail. Even if you managed to get sendmial to send the message out, quite a lot of the Internet mail servers will reject mail from machines that aren't part of a registered domain. I can't tell from the way the question is phrased if there is a valid mail server for your local network, or if real email services are handled by your service provider. You should setup sendmail so that it uses the mail server for your local network to use that mail server as a relay. That's done by including:

define(`SMART_HOST', `mail.ours.tld.')dnl

in your .mc file and building a new sendmail.cf.

Now, if your real mail server is local it may not allow you to relay mail through it unless it recognizes your system as lying within the domain of the mail server, as evidenced by a reverse lookup of your system's IP or by finding a host record for your system on the mail server. That's probably why you got the "Relaying temporarily denied" when you attempted to use a local sendmail server. If that local machine is the real mail server for your local network you need to speak to your network administrators about the reverse lookup problem.

Author Comment

ID: 6256549
Here's the output I now get from Sendmail:
bash-2.03$ /usr/lib/sendmail -v richyz26@hotmail.com
yo yorichyz26@hotmail.com... Connecting to mailhost.com via relay...
richyz26@hotmail.com... Host unknown (Name server: mailhost.com: host not found)
/export/home/cfe/dead.letter... Saved message in /export/home/cfe/dead.letter

Before, it was complaining that my box had an unqualified hostname (solinf2) and it was saying that I need to set some $j var in the sendmail config file.  Then, I changed the hostname on the box, and I didn't get that error anymore.

Now, I suspect that I don't have sendmail properly configured.  I just used the default install for sendmail.  And, I'm working on getting it configured.  It doesn't look that easy so I might abandon Sendmail and try to get qmail working.  I wonder how I would configure things so that the java programs used qmail instead of sendmail if I did take this approach.

I might be facing an uphill battle since this sun box isn't part of a registered domain.

We don't have any internal mail server within our network.  (We just use pop accounts with some ISP).  I have a linux box that sends emails via sendmail within our network and it doesn't have any problems.  Sendmail on Solaris seems to be another beast!

I'm still battling it out.  Any advice?

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: 6257540
I got it working by temporarily using a registered domain name and ip from one of the servers here.

It seems it won't work without using a registered domain name.  I keep getting that host unknown error that I listed above.

Is there any way to do what I'm trying to do without a registered domain name?

If not, I'll give jlms the points since that command was very valuable in helping me troubleshoot this problem.

LVL 40

Accepted Solution

jlevie earned 300 total points
ID: 6257875
Yes you can make it work without having a registered domain name for the Solaris box. From everything that is in the question and other comments it would seem that this system is probably part of a local network that is using one of the private, non-routable, IP address ranges. And furthermore it seems likely that there is not a local DNS server for this network, and that your organization doesn't have a registered domain name. The solution will change slightly if any of that isn't true, which your local network administator will know.

Since you stated that you read mail via POP from your service provider's mail server, you will need to set up the Solaris system to use that SMTP server as an out-going mail relay or SMART HOST. Now for sendmail to run properly it will need to believe that it has a Fully Qualified Domain Name (FQDN) and that can be a made up name as long as it is defined properly. On a Solaris system the hostname is stored in several places and the easiest way to change the hostname is by doing a "sys-unconfig" and entering the correct data on the next boot. Ideally you'd like for the Solaris system to have a name that appears to lie within the domain of your service provider. So if you pop mail from, say, mail.our.provider.net you could make up a name that lies within that domain, say solbox1.our.provider.net. The only thing that would be important is that you not use an FQDN that actually exists (check by trying to resolve the name with nslookup, e.g., "nslookup solbox1.our.provider.net").

Okay, with a valid hostname on the box the next step is to configure sendmail to use your provider's mail server as a SMART HOST. That means creating a sendmail mc file with the correct definitions and building a sendmail.cf file from it. I'm not where I can see a Solaris 8 system right now, but I think the sendmail cf directory is in /usr/share. A pretty minimal mc file that should work for you follows. It will need editing to change the "our.provider.net" stuff to match that of your service provider and their mail server. Do make sure that that you don't use a windows box to mess with the data or it'll insert carriage returns on each line and that'll cause problems. Also when you paste it from this question you'll probably have white space at the beginning of each line which must be removed.

# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
#       All rights reserved.
# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
# Copyright (c) 1988, 1993
#       The Regents of the University of California.  All rights reserved.
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.

#  This is a generic configuration file for SunOS 5.x (a.k.a. Solaris 2.x)
#  It has support for local and SMTP mail only.  If you want to
#  customize it, copy it to a name appropriate for your environment
#  and do the modifications there.

VERSIONID(`$Id: generic-solaris2.mc,v 8.11 1999/02/07 07:26:03 gshapiro Exp $')
define(`SMART_HOST', `mail.our.provider.net.')dnl

The above sould be saved in the cf directory as sendmail.mc. While in that directory you can build the new sendmail.cf file with the command:

m4 ../m4/cf.m4 sendmail.mc >sendmail.cf

Copy the resultant sendmail.cf file to /etc/mail and restart sendmail. It should start up without fussing and you should be able to send an outgoing message with sendmail directly (as above) or with:

> mail -s "Test message" some-addr@some.dom
...type in message, Control-D when done...

A good test would be to send a message to your email account at your ISP.
LVL 21

Expert Comment

ID: 8051510
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- Answered by jlevie

Please leave any comments here within the next 7 days


Cleanup Volunteer

Expert Comment

ID: 8100121
per recommendation

Community Support Moderator @Experts Exchange

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

572 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