Sendmail

sepia

Registered
Never had problems with this on PB, but I've got the final now and it's really frustrating me.

Sendmail won't start. It keeps telling me that /etc/mail/local-host-names is in a group writable directory. Changing the permissions doesn't do a thing.

This question has been posted before, but with no good response. Any ideas?
 

ChrisL

Registered
Its the root ( / ) directory that is group writable. You can change it to mode 755 and fix the problem with:

chmod 755 /

(as root). But You'll need to be root to add directories or create files now (not just admin priviledges.

Another option would be to add the conf DONT_BLAME_SENDMAIL to your m4 config file.

I myself am trying to figure out why it won't receive mail.

 

gdif

Registered
It's not working because it's sleeping. Check your /var/log/mail.log and you'll see entries like this:

Mar 24 19:52:15 localhost sendmail[1700]: My unqualified host name (localhost) unknown; sleeping for retry
Mar 24 20:01:00 localhost sendmail[1741]: My unqualified host name (localhost) unknown; sleeping for retry
Mar 24 20:03:23 localhost sendmail[1749]: My unqualified host name (localhost) unknown; sleeping for retry
Mar 24 20:13:35 localhost sendmail[1772]: My unqualified host name (localhost) unknown; sleeping for retry


Damned if I can figure out how to fix it though. Nothing I've done seems to work.

--gdif
 

sepia

Registered
Yes, I got sendmail to start listening by chmod'ing the root directory. (Figured it out shortly after posting my first message.)

Now it won't recognize emails to users. (User unknown error.) I've got the domain in my local-host-names file. I'll try the relay-domains file now, but that seems wrong...
 

gdif

Registered
Well, I did the chmod, that fixed that problem. Found where to put the domain name (/etc/hostconfig) but now any mail I try to send gets "no route to host" errors generated in mail.log.

What's odd about that is that the error has the domain name and the ip address of the host, but then it says it can't get there.

Thoughts?

--gdif
 

stovak

Registered
I had this SENDMAIL problem with the pubic beta. Occasionally I would send an email and for some reason, Sendmail would have problem looking up localhost. I never solved it, but I noticed I didn't have it after I started doing my own DNS locally. Getting named running on the machine seemd to satisfy this error.
 

ChrisL

Registered
Solved a number of problems, although perhaps non-conventionally.

First things first, /etc/mail/local-host-names _has to_ contain the domain(s)/host(s) for which you are receiving mail.

Next, although not entirely necessary, sendmail complains a lot less and starts up faster if your hostname is set. You can set it manually with "hostname your.hostname.here.com", or perhaps in /etc/hostconfig under the "HOSTNAME=" line. I haven't rebooted yet to verify this, but from the /System/Library/Startup/Network script seems to verify this. It'll sleep and retry if you don't, but eventually it'll startup for queing.

After a few frustrating hours trying to figure out why "mail.local" didn't have the correct permissions to write to /var/mail, I got it to work by making it setuid root (ie: chmod u+s /usr/sbin/mail.local). Now, this probably isn't the greatest idea, but it did deliver mail. I recompiled the latest sendmail (8.11.3) just to be sure that it wasn't an Apple problem, and the same thing is required for that build. It talks about some different compile options for SYS V based Unixes, but BSD is not, so I would think they don't apply.

A more desirable solution for me was to compile and install procmail (www.procmail.org) and enable it as the local mail delivery agent in the sendmail.cf file. For my installation, the following config options in the .m4 file did the trick:

define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')
FEATURE(local_procmail)

Or, alternatively, you can edit the Mlocal file in /etc/mail/sendmail.cf similar to the following:

Mlocal, P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
A=procmail -Y -a $h -d $u

Hope this saves some time for some people.

 

Zim

Registered
First question... is the definitive test that one can telnet to port 25?
(using 127.0.0.1)? ie. if your ISP blocks incoming port 25, will that be a local loopback before it can get blocked? (I'm assuming yes).

Ok, what I have tried so far from tips I have seen....

- I have done a chmod 755 on /
- I have changed /etc/hostconfig to read
hostconfig:MAILSERVER=-YES-
- I have done a chmod 755 on /private/etc (this cleared up a LOT
of msgs in /var/logs/mail.log)

my permissions....

top level: drwxr-xr-x 30 root admin 976 Apr 3 09:37 .

lrwxr-xr-x 1 root admin 11 Apr 3 09:37 etc -> private/etc
drwxr-xr-x 7 root wheel 264 Apr 3 09:38 private

in private:
drwxr-xr-x 70 root wheel 2336 Apr 2 20:17 etc


At this point my /var/logs/mail.log has

Apr 3 09:46:11 localhost sendmail[225]: My unqualified host name (localhost) unknown; sleeping for retry

Now I do have a dyndns acct, or should I use my Roadrunner, but then that really doesn't have a hostname, does it? Exactly what does sendmail need the hostname for?

What I'm trying to accomplish.... I'm a dinosaur, I admit it. I am thrilled to finally have unix on my Mac. I love both the cli and the gui. finally they are unified.

I'm trying to consolidate my mail accts. One thing I value tho is being to get to mail mail from virtually anywhere any time. Also I want to consolidate mail from several accts I have.

So I want to run fetchmail to grab my mail from various points and it passes mail off to sendmail (hence my need for sendmail as a delivery agent?) into /var/mail/$USER. From there I will use elm (told you I'm a dinosaur), which I finally got to compile. Its important to me NOT to need a gui. Yes I'm sure there are plenty of GUI mail programs that can fetch from multiple accts, but I want something simple.

Anyway, I cannot telnet to 25 yet (host refused connection), and a ps-auxww shows no sendmail process running.

Using procmail as the MTA for fetchmail is another option I suppose, but I'd like to at least understand how to get sendmail working and go from there.

Thanks for any help,
Mike

 

sepia

Registered
If sendmail isn't a running process start it like this:

/usr/sbin/sendmail -bd -q15m

or -q1h, or whatever.

This seems to be a problem, though. Even when MAILSERVER is set to "Yes" in hostconfig, the daemon doesn't seem to start when I reboot. I have to do it manually.

Another tip that might be helpful. Set your hostname and domainname using the commands:

hostname mymachine
domainname mydomain

 

Zim

Registered
Ok, making progress :)

I had to make sure /etc/mail did not have group write permissions.

then following your advice I did

sudo domainname dyndns.org
sudo hostname my_dyndns_subdomain

sudo /usr/sbin/sendmail -bd -q1h &

and I could finally telnet to port 25.

Fetchmail was then able to retrieve my POP mail.

I tried outgoing mail and did not have any luck.

I found that I needed to set hostname to my full hostname, not just the machine under the domain. As far as I could tell domainname wasn't being picked up at all (my mail was coming from me@hostname only, not me@hostname.domainname as I thought it might).

Anyway, at this point, outgoing mail works.

Fetchmail can now retrieve outside mail. I'm having a mailbox lock problem with elm, but I guess I can pound on that.

So I tried sending myself some mail (to zimmy@zimmy.dyndns.org)

My mail I send from an outside acct bounces... and I get a message about mail relaying being denied... that _could_ be RoadRunner filtering port 25?

So from my machine I telnet to port 25
mail from: me@outside.isp
rcpt to:zimmy
data
testing
.

Oh, I also found that I needed to set host = myhost

And that works. So I guess RR is blocking incoming port 25?

Thanks for the help,
Mike
 

sepia

Registered
Oh yeah, I forgot it had to be hostname full.host.name.

RR isn't blocking port 25. If that were the case you wouldn't be getting a "Relaying Denied" message from your mail server at all. Check /var/log/mail.log

Make sure you've got your domain name in the local-host-names file in /etc/mail.

 

Zim

Registered
First let me say that I greatly appreciate the replies :)

Can you supply the format for an entry in the local-host-names file?

Mine currently is at 0 length :)

And looking around at the various *nix systems to which I have access, I can find no example to go by.

So you are correct, RR is not blocking.

in /var/log/mail.log I have

Apr 3 14:50:27 localhost sendmail[932]: f33IoQG00932: ruleset=check_rcpt, arg1=<zimmy@zimmy.dyndns.org>, relay=smtp3.vnet.net [166.82.1.33], reject=550 5.7.1 <zimmy@zimmy.dyndns.org>... Relaying denied

So its getting to me, I guess my machine still isn't sure what to do with it, or thinks it is for someone else and denying wanting to relay it?

Note, I have not editted HOSTNAME=-AUTOMATIC- in /etc/hostconfig yet either (again, not certain of the needed format).

Thanks,
Mike
 

Zim

Registered
One further thing I found I needed to change was in

/etc/rc.boot

hostname yourhost.domain

Sendmail still does not start at boot, but I can launch it and now receive mail to my username. So that is good progress :)

Mike
 

sepia

Registered
1. chmod g-w /
Make root directory not group writable.

2. Edit /etc/hostconfig:
HOSTNAME=-my.domain.com-
# Not convinced this really does anything, but oh well.

3. Edit /etc/rc.boot:
hostname my.domain.com
domainname domain.com

4. Edit /System/Library/StartupItems/Sendmail/Sendmail:
/usr/sbin/sendmail -bd -q1h
# removed the "&", helps it start on boot

5. Edit /etc/mail/local-host-names
my.domain.com
domain.com

Did I miss anything? Let me know and we'll repost.

 

sepia

Registered
Original Message (somebody tell me how to do the quote block):

Apr 3 14:50:27 localhost sendmail[932]: f33IoQG00932: ruleset=check_rcpt, arg1=, relay=smtp3.vnet.net [166.82.1.33], reject=550 5.7.1 ... Relaying denied

It looks like you are talking to your Mac from a remote location and trying to pass mail through to a recipient that is not local to your Mac. By default sendmail won't do this! (Wouldn't want spammers using your Mac for their dirty little activities.)

Unfortunately, Darwin doesn't include support for an "access" file with its default build. You'll have to download sendmail and make a "sendmail.cf" file with support for the access file. (Maybe virtusertable while you're at it.)

I'll try to get around to posting instructions for that if no one else does.
 

sepia

Registered
---- Original message -----
Unfortunately, Darwin doesn't include support for an "access" file with its default build. You'll have to download sendmail and make a "sendmail.cf" file with support for the access file. (Maybe virtusertable while you're at it.)
---------------------------------------

I take it back, silly me. While you can build the access file, an easier solution is to add the machine you need relaying for to the file /etc/mail/relay-domains

Then send a hangup signal (kill -HUP) to sendmail and the machine you're coming in from will be able to relay mail.
 

gaboosh

Registered
Sepia-

Do you think you could elaborate, or plain ol' explain, what you mean when you say:

…an easier solution is to add the machine you need relaying for to the file /etc/mail/relay-domains

how do we "add the machine" and does that mean that if I want to go away and use my server at home for smtp, i can't unless it's in the relay-domains file?

Thanks.

Gabriel
 

sepia

Registered
Yes, I'll try to explain:

Under the default, out of the box install, the SMTP server will not relay mail (that is, accept mail for a user not on the local machine) unless you're connecting from a machine that's 1.) the local machine 2.) a machine in the relay-domains file.

Try this:

Connect to a machine that's not your Mac. Get a shell prompt.

You type:
telnet my.macs.address 25

You see:
Connected to my.macs.address.
Escape character is '^]'.
220 my.macs.address ESMTP Sendmail 8.10.2/8.10.2; Wed, 25 Apr 2001 21:43:19 -0500 (CDT)

You type:
MAIL FROM: me@myaddress

You see:
250 2.1.0 me@myaddress... Sender ok

You type:
RCPT TO: mybuddy@yahoowhatever.com

You see:
550 5.7.1 mybuddy@yahoowhatever.com... Relaying denied

You type:
QUIT

You got relaying denied because the machine you're on is not authorized to pass mail through the server. If you were to address the message to a local user, it would have accepted it. But you addressed it to someone somewhere else. Hence relaying denied.

Now try the same after you've added a line in relay-domains that is the IP address or host name (ie another.machine.com) of the machine you're trying to connect from. This time it will work. Make sure you hangup sendmail (kill -HUP pid) after editing the relay-domains file.

Yes, this probably confuses the issue more, but I'm willing to keep talking until I actually make sense so just ask.

 

sepia

Registered
But to actually ANSWER YOUR QUESTION:

Yes, that's what it means. You can't go away and use your Mac as an SMTP server.

You add the machine to your relay domains file by simply adding a line that is the host name. A sample relay-domains file could look like this:

machine1.mydomain.com
machine2.mydomain.com
192.168.0.54

That's pretty much it.
 
Top