Link to home
Start Free TrialLog in
Avatar of Silas2
Silas2

asked on

Sendmail not sending

I just installed sendmail on Ubuntu. I only want it for sending via an smtp relay, not as server.
I followed the instructions here:
http://linuxconfig.org/configuring-gmail-as-sendmail-email-relay
But when I try a really simple command line send, I don't receive any message.
when I look in sendmail.mc, it started off empty, but I added the text from the blog, although it looked from the blog like there should have been something there already...?
SOLUTION
Avatar of Carl Dula
Carl Dula
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, you typically need to configure your mail server to accept a relay from the ip of the system with sendmail.
Avatar of Silas2
Silas2

ASKER

Thanks for looking at this for me.
With the -v option, its showing me that its trying to relay from an old domain where there was a mail server...not my new one.
I followed the instructions in the blog:
AuthInfo: "U:root" "I:YOUR GMAIL EMAIL ADDRESS" "P:YOUR PASSWORD"
and
makemap hash gmail-auth < gmail-auth
(i'm not using gmail though)
but its still using this old domain...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Silas2

ASKER

I'm pretty sure the mail server's ok, I can relay from it.

should that be:
MAIL.Djmydomainchoice.com
(or whatever the mail server is called)?
No, the Dj is the definition part and must come first, and the domain is the rest.

For example:   DJgoogle.com would send mail as if it was from google.com

It is your main domain name that you send mail as, not an internal name for a server.
Avatar of Silas2

ASKER

I'm trying to relay from an smtp server, I put into a file called gmail-auth:
AuthInfo:mail.mysmtpserver.com "U:root" "I:mailboxnam@mysmtpserver.com" "P:pwd"
then makemap hash gmail-auth < gmail-auth,
then I put into  sendmail.mc :
define(`SMART_HOST',`[mail.mysmtpserver.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/authinfo/gmail-auth.db')dnl

Open in new window

Was that wrong?
The changes I indicated were for the sendmail.cf file not the sendmail.mc

sendmail.cf is created when you run m4 on the .mc

Please post the output showing the error using  "mail -v" option
Avatar of Silas2

ASKER

This is the -v read-out. The truenotesdomain.com is an old domain that  I dont' want to use as an smtp relay
root@mail:/etc/mail/authinfo# sendmail -v hotmailrecip@hotmail.com
helo
hotmailrecip@hotmail.com... Connecting to [127.0.0.1] via relay...
220 mail.truenotesdomain.co.uk ESMTP Sendmail 8.14.4/8.14.4/Debian-8; Tue, 7 Jul 2015 14:28:39 GMT; (No UCE/UBE) logging access from: ip6-localhost(OK)-ip6-localhost [127.0.0.1]
>>> EHLO mail.truenotesdomain.co.uk
250-mail.truenotesdomain.co.uk Hello ip6-localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<root@mail.truenotesdomain.co.uk> SIZE=5 AUTH=root@mail.truenotesdomain.co.uk
250 2.1.0 <root@mail.truenotesdomain.co.uk>... Sender ok
>>> RCPT To:<hotmailrecip@hotmail.com>
>>> DATA
250 2.1.5 <hotmailrecip@hotmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <hotmailrecip@hotmail.com>... Connecting to mx3.hotmail.com. via esmtp...
050 220 COL004-MC4F21.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.microsoft.com/en-us/anti-spam.mspx. Tue, 7 Jul 2015 07:28:48 -0700
050 >>> EHLO mail.truenotesdomain.co.uk
050 250-COL004-MC4F21.hotmail.com (3.21.0.194) Hello [162.13.42.109]
050 250-SIZE 36909875
050 250-PIPELINING
050 250-8bitmime
050 250-BINARYMIME
050 250-CHUNKING
050 250-STARTTLS
050 250-AUTH LOGIN
050 250-AUTH=LOGIN
050 250 OK
050 >>> STARTTLS
050 220 SMTP server ready
050 >>> EHLO mail.truenotesdomain.co.uk
050 250-COL004-MC4F21.hotmail.com (3.21.0.194) Hello [162.13.42.109]
050 250-SIZE 36909875
050 250-PIPELINING
050 250-8bitmime
050 250-BINARYMIME
050 250-CHUNKING
050 250-AUTH LOGIN
050 250-AUTH=LOGIN
050 250 OK
050 >>> MAIL From:<root@mail.truenotesdomain.co.uk> SIZE=318 AUTH=<>
050 250 root@mail.truenotesdomain.co.uk....Sender OK
050 >>> RCPT To:<hotmailrecip@hotmail.com>
050 >>> DATA
050 250 hotmailrecip@hotmail.com
050 354 Start mail input; end with <CRLF>.<CRLF>
050 >>> .
050 250  <201507071428.t67ESZ2A008303@mail.truenotesdomain.co.uk> Queued mail for delivery
050 <hotmailrecip@hotmail.com>... Sent ( <201507071428.t67ESZ2A008303@mail.truenotesdomain.co.uk> Queued mail for delivery)
250 2.0.0 t67ESdSD008304 Message accepted for delivery
hotmailrecip@hotmail.com... Sent (t67ESdSD008304 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't see any errors in the above. Have you checked the mail server to see that the mail is leaving that box?

Setting DJ to what you want should get rid of the old domain.
Avatar of Silas2

ASKER

Noooooo, i'm saying the mail server mail.truenotesdomain.com is not the mail server I want to use, I want to use:
mail.mynewdomain.com
but for some reason it keeps using this old one, and I don't (in my very cack-handed way) seem to be able to configure it for this new one...
Did you run /etc/mail/make  after you updated sendmail.mc?

If so, did you "kill -HUP <pid of sendmail accepting connections"
Avatar of Silas2

ASKER

I ran the make, yes, but the kill command, is that a process? (not file)
I have restarted sendmail ....but the sendmail is only for sending (notifications)
restarted works, also,

grep DS /etc/mail/sendmail.cf

what shows as the relay?
Avatar of Silas2

ASKER

root@mail:/etc/fail2ban# grep DS /etc/mail/sendmail.cf
DS
# Return-Receipt-To: header implies DSN request
# DHParameters (only required if DSA/DH is used)
you don't have a relay specified in the cf file.

     grep -i smart /etc/mail/sendmail.mc

as root,
    /etc/mail/make
         or
    make -C /etc/mail

then,
    grep DS /etc/mail/sendmail.cf
Avatar of Silas2

ASKER

'Make', doesn't that do a recompile/build?
Do I really have to recompile the sendmail app to configure a smtp relay to replace the one I've got?
it's "make" not "Make" and what is does it does is rebuild your sendmail.mc to a sendmail.cf (along with your other files in that directory) -- not sendmail itself.
Did you set the smart host in sendmail.cf as per my first post above ID: 40870553? That controls where it sends the outgoing mail.
Avatar of Silas2

ASKER

Ok, ran the make, after installing the sasls...this is what I got:
make: Entering directory '/etc/mail'
Updating auth ...
Creating /etc/mail/sasl/sasl.m4...

Ah, you're setup with SASL2 !

Unfortunately, there is no automagic way to migrate to /etc/sasldb2 :(

You'll want to make sure /etc/default/saslauthd is setup to start,
and has at least MECHANISMS="pam" !

If you find out what more is needed, please let me know!

To enable sendmail to use SASLS, you need to:
1) Add this line to /etc/mail/sendmail.mc and optionally
   to /etc/mail/submit.mc:
  include(`/etc/mail/sasl/sasl.m4')dnl
2) Run sendmailconfig
3) Restart sendmail

SASL2 is now minimally setup, there are a few ways to handle users:
   *) Allow only shell users (default)
  You're all set, nothing else to do !
   *) Allow users other than shell
  Add users via /usr/sbin/saslpasswd2 and make sure that the
  realm you used matches what your users specify in their
  netscape/outlook/mutt/etc profiles.

If you need to authorize sendmail as a sender, also update
/etc/mail/default-auth-info and rerun /usr/share/sendmail/update_auth.

Creating /etc/mail/relay-domains
# Optional file...
The following file(s) have changed:
  /etc/mail/relay-domains
** ** You should issue `/etc/init.d/sendmail reload` ** **

Open in new window

oh please don't modify the cf file!  

have you reloaded/restarted sendmail?

is the smarthost listed in sendmail.cf?

are you using SMTP AUTH for IP addresses not trusted?
Avatar of Silas2

ASKER

Thanks for all your help. Let me just try...
I must be missing something here. Why are you trying SASL now? Looking at the output of the mail -v you posted, it is authorizing correctly. Given that both systems are on your lan, do you really need to login? From what I see here all you have to do is set DS and it should give you what you want.

I will bow out since my advice and that from Jan Springer is contradictory, and may cause confusion. If you want me to respond, please address carlmd.

good luck
it's all well and good to directly modify the sendmail.cf *when you are very familiar* with it's configuration and rules.

never recommended for someone that cannot read it to go back and fix it.
Avatar of Silas2

ASKER

End of day now...back to it tmrw
if you have teamviewer and want to use that for assistance, drop me an email at EE.