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:

  • server: mail.server.remote, port 25
  • user: username@server.remote
  • password: password123456

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

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

2 Answers 2

3

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
    May 19, 2015 at 10:39
  • 1
    What is the maillog saying about your test email?
    – Lambert
    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:user@your.smtp.server" "I:user" "P:passwd" "M:LOGIN PLAIN". This works! Thanks!
    – SPRBRN
    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
    Feb 7, 2017 at 15:33
  • @SPRBRN What is the I: for???? 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.