sending the messages to root in openbsd

Missing Ghost

Senior member
Oct 31, 2005
254
0
76
Hi,
openbsd ships with sendmail listening on the localhost to send messages from the daily scripts and things like that.
However, I must specify a relay smtp server from my isp, or the messages get blocked.
Where do I put that parameter?
btw, I don't understand mailing systems, and I'm a bsd noob.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
I don't know a whole lot about the sendmail setup, but I believe all messages mailed out about the machine just go to root on that machine, which means they get dropped in /var/mail. You shouldn't have to configure a relay unless you actually want to send other stuff out.
 

Missing Ghost

Senior member
Oct 31, 2005
254
0
76
yes but I mean to get the stuff sent to /var/mail/root to go to the email adress specified for root
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Like kamper said, root's mail will probably be delivered to the local machine unless you said otherwise during the install. If you did specify an external address (you can check this in /etc/mail/aliases), you need a "smart host." That means that sendmail will deliver local mail itself, but will pass off all non-local mail to the smart host. You should be able to set it up as follows - note that while I've done lots of other sendmail configuration, I haven't actually tried this one:

1) Edit /etc/mail/localhost.mc. Close to the top, after the "OSTYPE" line but before the features, add the following line:

define(`SMART_HOST', `mail.yourisp.net')

2) Rebuild the sendmail.cf file from the mc file:

cd /etc/mail
m4 /usr/share/sendmail/m4/cf.m4 localhost.mc > sendmail.cf

3) Find sendmail's pid:

cat /var/run/sendmail.pid

4) Restart sendmail:

kill -1 [pid you saw above]

I think that should work. Wouldn't hurt to make backups of your localhost.mc and sendmail.cf files before you start though.
 

Missing Ghost

Senior member
Oct 31, 2005
254
0
76
but I don't have a /etc/mail/localhost.mc
# cd /etc/mail
# ls localhost.mc
ls: localhost.mc: No such file or directory
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
cp /usr/share/sendmail/m4/openbsd-localhost.mc /etc/mail/localhost.mc

Now you have a localhost.mc. :)
 

Missing Ghost

Senior member
Oct 31, 2005
254
0
76
# cp /usr/share/sendmail/m4/openbsd-localhost.mc /etc/mail/localhost.mc
cp: /usr/share/sendmail/m4/openbsd-localhost.mc: No such file or directory
# cd /usr/share/sendmail/m4/
# ls
cf.m4 cfhead.m4 proto.m4 version.m4
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Sorry, my typo...

cp /usr/share/sendmail/cf/openbsd-localhost.mc /etc/mail/localhost.mc