Solved Configuring sendmail to use a relay host

Hi!

I am pretty new to FreeBSD and try to achieve things by adopting the FreeBSD way. I want to suppress the reflex of using the Linux way.

The next little hurdle is to configure sendmail to use a relay host.

Can you please point me to a link explaining this.

I need to set aliases as well to send mails, addressed to root to be forwarded to a "real mailaccount".

Thanks a lot for any hint

Dirk
 
Geezer that doesn't configure sendmail to forward all mail to a relay server. It configures sendmail to be a relay host.

As root:
Code:
cd /etc/mail
make
vi `hostname -f`.submit.cf
# Change the DS line to
DSmy.relay.host

make install
make restart
 
This is called a "smarthost".
aliases(5), there's even an example at the top of /etc/aliases. And don't forget to run newaliases(8).

It worked pretty well. Aliases are done the same way as in Linux. Change them in /etc/aliases and run newliases.

I edited /etc/mail/freebsd.mc followed by m4 on that file.

Code:
define(`SMART_HOST',`my.mail.relay')

Cheers

Dirk
 
Code:
cd /etc/mail
make
Then edit $(hostname -f).submit.mc. Once edited run make install and make restart.
 
Pardon the necrobump of this thread, but is .submit.mc still the correct configuration file to make the smart host configuration?

The file example.com.mc contains the following lines:

Code:
dnl Dialup users should uncomment and define this appropriately
dnl define(`SMART_HOST', `your.isp.mail.server')

I uncommented that line and changed the hostname to the correct one. I also added a macro for the special non-standard port that is needed for my smart host. Everything works as expected. The following are the resulting lines in the configuration file.

Code:
dnl Dialup users should uncomment and define this appropriately
define(`SMART_HOST', `smtp.example.com')
define(`RELAY_MAILER_ARGS', `TCP $h 2525')dnl
 
UPDATE for FreeBSD 14 which uses dma(8) (Dragonfly Mail Agent) for its default MTA.

Edit /etc/dma/dma.conf and uncomment & set the SMARTHOST configuration value:

Code:
SMARTHOST smtp.example.com

Now all your mails will be relayed through smtp.example.com.

That's it!
 
Code:
define(`SMART_HOST',`my.mail.relay')
Publicly visible mail relays will have an MX record, and the above will work. If it's an internal relay, then you either need to put an MX record in your internal DNS, or if that's too hard, put square brackets around the host name [my.mail.relay] to force sendmail to skip the MX record lookup, and use address (A or AAA) records.
 
It worked pretty well. Aliases are done the same way as in Linux. Change them in /etc/aliases and run newliases.

I edited /etc/mail/freebsd.mc followed by m4 on that file.

Code:
define(`SMART_HOST',`my.mail.relay')

Cheers

Dirk

I used to directly hack the .cf file. Never learned the macro language, just moved on
 
Back
Top