Solved

Sendmail woes on Solaris 8

Posted on 2001-07-02
7
1,009 Views
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@192.168.0.1).  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 192.168.0.1 (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 :)


0
Comment
Question by:richyz26
7 Comments
 
LVL 4

Expert Comment

by:jlms
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.
0
 
LVL 40

Expert Comment

by:jlevie
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.
0
 

Author Comment

by:richyz26
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
bash-2.03$

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?

Thx
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:richyz26
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.

Thx!
0
 
LVL 40

Accepted Solution

by:
jlevie earned 75 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.

---sendmail.mc-begins-here---
divert(-1)
#
# 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.
#

divert(0)dnl
VERSIONID(`$Id: generic-solaris2.mc,v 8.11 1999/02/07 07:26:03 gshapiro Exp $')
OSTYPE(solaris2)dnl
DOMAIN(generic)dnl
MASQUERADE_AS(our.provider.net)
FEATURE(masquerade_envelope)
FEATURE(masquerade_entire_domain)
define(`SMART_HOST', `mail.our.provider.net.')dnl
MAILER(local)dnl
MAILER(smtp)dnl
---ends-here---

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.
0
 
LVL 20

Expert Comment

by:tfewster
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

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8100121
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

706 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

19 Experts available now in Live!

Get 1:1 Help Now