3

I would like to setup sendmail to send out mail using an external smtp-server with authentication. I've searched for solutions, but can't seem to find what I need. There are several examples about ssmtp and using gmail as smarthost, but then I read that ssmtp is not for servers.

For authentication I have:

Sendmail is installed and running. (Postfix is not installed.)

How do I configure sendmail to use the external smpt server?

2 Answers 2

4

Edit your sendmail.mc and add:

define (`SMART_HOST', `your.smarthost')dnl
FEATURE (`authinfo')dnl

Create the file /etc/mail/authinfo with content:

AuthInfo:your.smarthost    "U:username" "P:password"

Make new sendmail config:

If you have sendmail-cf package installed:

make -C /etc/mail

Otherwise

cd /etc/mail
m4 ./sendmail.mc > ./sendmail.cf
makemap hash ./authinfo < ./authinfo

Restart or reload sendmail

6
  • 1
    When I run the make or m4 command, I get the following error: m4:./sendmail.mc:27: cannot open ``/usr/share/sendmail-cf/feature/.m4': No such file or directory. It turns out that the FEATURE (``authinfo')dnl line should not be directly after the define command, but should be put with the other FEATURE lines. The make succeeded afterwards, but a testmail via commandline doesn't arrive.
    – SPRBRN
    Commented May 19, 2015 at 10:39
  • 1
    What is the maillog saying about your test email?
    – Lambert
    Commented May 19, 2015 at 12:09
  • 2
    The log said: Temporary AUTH failure. So I've checked the login to be correct, and used the following AuthInfo format: AuthInfo:your.smtp.server "U:[email protected]" "I:user" "P:passwd" "M:LOGIN PLAIN". This works! Thanks!
    – SPRBRN
    Commented May 19, 2015 at 13:14
  • See also dnsexit.com/support/mailrelay/sendmail.html for basically the same info. Worked first time for me with sendmail 8.14.4.
    – Atafar
    Commented Feb 7, 2017 at 15:33
  • @SPRBRN What is the I: for???? Commented Mar 5, 2018 at 19:38
0

The problem is the space between the word FEATURE and thew opening bracket Change it to FEATURE(``authinfo')dnl and it works fine

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .