LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-07-2018, 11:36 AM   #1
danix85
LQ Newbie
 
Registered: Apr 2007
Location: italy
Distribution: Slackware64-current
Posts: 16

Rep: Reputation: 10
Question configure sendmail to use external smtp server


Hello everyone,
I have an OpenVZ VPS on hostus with Slackware64-14.2 on it, I'm trying to configure sendmail to manage only the outgoing queue using an smtp server from namecheap.

I've read a ton of how-tos about this particular purpose, even a few old threads here on lq, but so far I'm stuck.

Here's what I did, on a fresh install of sendmail I've created the directory /etc/mail/auth, inside of it I've put the file client-info with this line in it:
Code:
AuthInfo:your.isp.net "U:root" "I:emailuser" "P:emailpassword"
created the database with:

Code:
makemap hash client-info < client-info
and set the two files like this:

Code:
-rw------- 1 root root  75 May  7 17:52 client-info
-rw------- 1 root root 12K May  7 17:56 client-info.db
I've used the sendmail-slackware.mc to build a cf, I added the lines
Code:
define(`SMART_HOST',`your.isp.net')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
and then I did:

Code:
m4 sendmail-slackware.mc > slack.cf
backed up the original sendmail.cf shipped with the package and substituted it with my version of it.

started the server and /var/log/maillog says that the server has started, but when I tested it with:

Code:
sendmail -vt < testmail.txt
maillog stated:
Code:
May  7 18:04:54 danix sendmail[23249]: w47G4sjL023249: from=root, size=139, class=0, nrcpts=1, msgid=<201805071604.w47G4sjL023249@mysite.net>, relay=root@localhost
May  7 18:04:54 danix sendmail[23249]: w47G4sjL023249: to=my@email.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30139, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
I'm not really sure how to read that log, but I think it shouldn't say that the relay is localhost, but I have no idea of what to modify.

Could you please point me in the right direction?
 
Old 05-07-2018, 01:14 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,340

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
May I suggest you do nothing and try a test mail to a real email. If that relays through the external server, you're ok.

Sendmail is a server, and your external server is redundancy, although I'm sure you have your reasons for it. It's not surprising that sendmail thinks of itself as the relay. I wouldn't take the log too seriously.
 
Old 05-07-2018, 02:11 PM   #3
danix85
LQ Newbie
 
Registered: Apr 2007
Location: italy
Distribution: Slackware64-current
Posts: 16

Original Poster
Rep: Reputation: 10
the test mail I tried was towards a real email address but sendmail didn't relay on the external SMTP server. I know sendmail is capable of doing so for outgoing emails but I haven't been able to set it up properly.

the reason for a setup like this is to not to have to setup a fully fledged email server on top of the other services that I want this server to offer, resource and security wise.

having sendmail setup like this means that it is no longer listening for incoming emails, so less room for troubles.
 
Old 05-07-2018, 03:21 PM   #4
asdrubale
LQ Newbie
 
Registered: Aug 2012
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by danix85 View Post
Here's what I did, on a fresh install of sendmail I've created the directory /etc/mail/auth, inside of it I've put the file client-info with this line in it:
Code:
AuthInfo:your.isp.net "U:root" "I:emailuser" "P:emailpassword"
I'm using a similar configuration, but in my client-info I have
Code:
"U:smmsp"
instead of
Code:
"U:root"
and it works fine with Gmail SMTP servers.
 
1 members found this post helpful.
Old 05-08-2018, 02:27 AM   #5
danix85
LQ Newbie
 
Registered: Apr 2007
Location: italy
Distribution: Slackware64-current
Posts: 16

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by asdrubale View Post
I'm using a similar configuration, but in my client-info I have
Code:
"U:smmsp"
instead of
Code:
"U:root"
and it works fine with Gmail SMTP servers.
thanks, I tried setting smmsp as the user but the mail keeps getting relied through 127.0.0.1

do you mind posting your config for sendmail? Maybe I'm missing something there.
 
Old 05-08-2018, 06:24 AM   #6
asdrubale
LQ Newbie
 
Registered: Aug 2012
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by danix85 View Post
do you mind posting your config for sendmail? Maybe I'm missing something there.
sendmail.cf:

Code:
include(`../m4/cf.m4')
OSTYPE(linux)dnl
define(SMART_HOST, smtp:smtp.gmail.com)dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/client-info.db')dnl
FEATURE(always_add_domain)dnl
FEATURE(access_db)dnl
FEATURE(accept_unresolvable_domains)dnl
dnl I don't have visibility to outside my LAN
FEATURE(`accept_unqualified_senders')dnl
dnl to canonify the address you need DNS
FEATURE(`nocanonify')
FEATURE(no_default_msa)dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA, Addr=127.0.0.1')dnl
DAEMON_OPTIONS(`Port=587, Name=MSA, Addr=127.0.0.1, M=E')dnl
MAILER(local)dnl
MAILER(smtp)dnl
client-info:

Code:
AuthInfo:smtp.gmail.com "U:smmsp" "I:xxxxxxxxx@gmail.com" "P:xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
AuthInfo:smtp.gmail.com:587 "U:smmsp" "I:xxxxxxxxxxx@gmail.com" "P:xxxxxxxxxxxxxxxxxxxxxxxxxxx"
 
2 members found this post helpful.
Old 05-09-2018, 12:17 AM   #7
danix85
LQ Newbie
 
Registered: Apr 2007
Location: italy
Distribution: Slackware64-current
Posts: 16

Original Poster
Rep: Reputation: 10
thanks, I'll look into that as soon as I get back home.

I solved with msmtp now but I want to understand what was wrong with my settings.

thanks a lot..
 
  


Reply

Tags
external, sendmail, server, smtp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure sendmail to use Gmail as SMTP server? narke Slackware 23 03-10-2014 02:02 PM
CentOS mail setup - sendmail via external SMTP server taing@jtkdev.com Linux - Networking 1 07-31-2011 05:29 AM
Can one configure sendmail to use an SMTP server? laggerific Linux - Software 1 02-16-2006 10:49 AM
configure sendmail to use a specific smtp server TheOneAndOnlySM Linux - Software 4 06-20-2004 05:15 AM
How to configure sendmail to use other smtp server? josealexandre Linux - Newbie 2 10-12-2003 05:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration