Sendmail issues

B

bartoszk

Guest
Hi,

I'm having some problems with sendmail in Linux. The thing is when I type the following command to send an e-mail:

Code:
sendmail [email protected]< test.txt

it looks like it executed but I don't receive the mail. The file test.txt looks like that:

Code:
To: [email protected]
Subject: Tests
From: [email protected]

TestTestTestTestTest
.

Logs show something like that:
Code:
$1.119], dsn=4.1.8, stat=Deferred: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found

In the /etc/hosts there are following lines:
Code:
127.0.0.1  localhost  localhost.linux.companydomain.pl
127.0.1.1  rtnagios  rtnagios.companydomain.pl
127.0.1.1  ubuntu-server  ubuntu-server.linux.companydomain.pl
192.168.1.119  linux  linux.companydomain.pl
127.0.0.1  companydomain companydomain.pl

# The following lines are desirable for IPv6 capable hosts
#::1  ip6-localhost ip6-loopback
#fe00::0 ip6-localnet
#ff00::0 ip6-mcastprefix
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters

The sendmail.mc file is:
Code:
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl
dnl #
dnl # Be somewhat anal in what we allow
define(`confPRIVACY_FLAGS',dnl
`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl
dnl #
dnl # Define connection throttling and window length
define(`confCONNECTION_RATE_THROTTLE', `15')dnl
define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl
dnl #
dnl # Features
dnl #
dnl # use /etc/mail/local-host-names
FEATURE(`use_cw_file')dnl
dnl #
dnl # The access db is the basis for most of sendmail's checking
FEATURE(`access_db', , `skip')dnl
dnl #
dnl # The greet_pause feature stops some automail bots - but check the
dnl # provided access db for details on excluding localhosts...
FEATURE(`greet_pause', `1000')dnl 1 seconds
dnl #
dnl # Delay_checks allows sender<->recipient checking
FEATURE(`delay_checks', `friend', `n')dnl
dnl #
dnl # If we get too many bad recipients, slow things down...
define(`confBAD_RCPT_THROTTLE',`3')dnl
dnl #
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
dnl #
dnl # If you're on a dialup link, you should enable this - so sendmail
dnl # will not bring up the link (it will queue mail for later)
dnl define(`confCON_EXPENSIVE',`True')dnl
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
define(`SMART_HOST',`companydomain.pl')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`smtp')dnl
dnl # Masquerading options

How can I fix that problem?
 


From log snippet mail was rejeted by the smarthost as it can't resolve the senders domain ubuntu-server.linux.companydomain.pl.
Problem looks to me that you didn't set the envelope sender via sendmails f option. If not set sendmail will just set it to USER @ HOSTNAME.

So running this should work for you:
Code:
 
Thanks for the reply but your fix sadly doesn't work for me. Any other idea?
 
It's the same as before. 450 4.1.8 Sender rejected. Domain not found.
 
The full log line would have been helpful. Is it correct that @ubuntu-server.linux.companydomain.pl changed to @linux.companydomain.pl there?
Just before the error code do you see IP of your smarthost "companydomain.pl" ending with 1.119 (from log snippet)?
Can you connect to your smarthost and just run the following giving it's output:
Code:
dig linux.companydomain.pl

This should give a positive return. If no postive return, you need to change the sending domain from linux.companydomain.pl to something resolving on your smarthost - maybe companydomain.pl.
When mail shouldn't be internal only, you need to use a valid domain that can be found in DNS otherwise mails will be rejected by other MTA's later on it's path.
 
Full log line:
Code:
$.1.119], dsn=4.1.8, stat=Deferred: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found

linux.companydomain.pl digged:
Code:
root@ubuntu-server:/home/companydomain# dig linux.companydomain.pl

; <<>> DiG 9.8.1-P1 <<>> linux.companydomain.pl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2628
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;linux.companydomain.pl.  IN  A

;; ANSWER SECTION:
linux.companydomain.pl.  0  IN  A  192.168.1.119

;; Query time: 107 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Thu Nov 20 11:46:15 2014
;; MSG SIZE  rcvd: 49

What now?
 
Curious, when using sendmails f option the envelope sender address should have changed and so the domain seen in the logs...
What is the from address of the last deffered mail seen in the logs? It should be close to the error messag with the same timestamp .
 
What is the from address of the last deffered mail seen in the logs? It should be close to the error messag with the same timestamp .
There's no from in logs, just lots of lines looking like this:

Code:
$xxx.pl> (0/0), delay=23:33:46, xdelay=00:00:00, mailer=relay, pri=12990338, relay=linux.companydomain.pl., dsn=4.0.0, sta$rver.linux.companydomain.pl> (0/0), delay=23:33:46, xdelay=00:00:00, mailer=relay, pri=12990338, relay=linux.companydomain.pl., dsn=4.$

And:
Code:
$1.119], dsn=4.1.8, stat=Deferred: 450 4.1.8 <[email protected]>: Sender address rejected: Domain not found

I thought maybe there's a problem with the local-host-names file (pasted in my first post) but I thing it's OK and, from what I know, it should be working just fine. But apparently it's not, so I'm confused and don't know how to fix it on my own.
 
Which distribution are you using and what is the full path of your maillog?
Do you get anything back when you run the following against your maillogs?
Code:
grep -iw from /var/log/mail*
 
Which distribution are you using
I would really appreciate it if you'd explain what exactly do you mean by that and/or how can I check it.


what is the full path of your maillog?

It goes like this:

Code:
var/log/mail.log



Do you get anything back when you run the following against your maillogs?

Code:
grep -iw from /var/log/mail*


Here's the output (link, the actual log is too long to paste it directly) I got:
wklej.to/Bbe0T

What's interesting is the fact that there are no logs from today, 20th November. The question is: why? There should also be logs from yesterday, I started struggling with sendmail on Wednesday. But there are not, which is strange.
 
Ok. From logs looks like your are using Ubuntu.

Regarding time, just validate that your system time is correct running: date
If time/date is correct, you may check your diskspace running: df -h
Feel free to share the results.

The following command looks for the error in question in the current log and gathers all depended lines for it together:
Code:
MAILLOG=/var/log/mail.log ; for ID in $(grep dsn=4.1.8 $MAILLOG|sed "s/^.*sendmail\[[0-9]*\]: \([^:]*\):.*$/\1/"|uniq) ; do echo -e "\nID: $ID" ; grep -w $ID $MAILLOG ; done

If any please provide the last two of them.
 
Regarding time, just validate that your system time is correct running: date
That's the first thing I did when I found the logs missing. The system time is correct.

If time/date is correct, you may check your diskspace running: df -h
Feel free to share the results.
These are the results:

Code:
System plików  rozm. użyte dost. %uż. zamont. na
/dev/sda1  29G  2,5G  26G  9% /
udev  990M  4,0K  990M  1% /dev
tmpfs  200M  580K  200M  1% /run
none  5,0M  0  5,0M  0% /run/lock
none  999M  0  999M  0% /run/shm

The following command looks for the error in question in the current log and gathers all depended lines for it together:
Code:
MAILLOG=/var/log/mail.log ; for ID in $(grep dsn=4.1.8 $MAILLOG|sed "s/^.*sendmail\[[0-9]*\]: \([^:]*\):.*$/\1/"|uniq) ; do echo -e "\nID: $ID" ; grep -w $ID $MAILLOG ; done
When I type that command and execute it it does nothing - looks like the console freezes. Or should I execute the command from some specific folder?
 
When date is correct i assume you already checked that syslog and sendmail are running. If not just check for them with:
Code:
ps -aux|egrep '(sendmail|syslog)'

For the former command no spezial folder is required. "Freezing" may come from a typo and often seen with the grep command when only one argument given. If you not already tried, please do cut&paste instead of typing.
 
When date is correct i assume you already checked that syslog and sendmail are running. If not just check for them with:
Code:
ps -aux|egrep '(sendmail|syslog)'

For the former command no spezial folder is required. "Freezing" may come from a typo and often seen with the grep command when only one argument given. If you not already tried, please do cut&paste instead of typing.
There had to be a typo indeed. After pasting your command the output goes on and on and on forever. Is that the right thing to happen? After pressing [Ctrl] + [Z] (stopping the output) it's the same as in mail.log. Still "Domain not found".
That's the output of the command you put in the above post:
justpaste.it/i31m
 
Should end up at max the full maillog size, so what is it currenty, e.g 'ls -l /var/log/mail.log'?

Just pipe the result through tail to just get the most recent one, e.g. add "|tail" to the command.
 
When I execute that command:
Code:
ls -l /var/log/mail.log|tail
there's what I get:
Code:
root@ubuntu-server:/home/companydomain# ls -l /var/log/mail.log|tail  -rw-r----- 1 syslog adm 3093195 lis 21 10:10 /var/log/mail.log
I don't know how it can be an important piece of information, but maybe it really is?
 
Sorry ment to add the pipe tail to the other one to reduce it's outeput to the most recent, e.g.:
Code:
MAILLOG=/var/log/mail.log ; for ID in $(grep dsn=4.1.8 $MAILLOG|sed "s/^.*sendmail\[[0-9]*\]: \([^:]*\):.*$/\1/"|uniq) ; do echo -e "\nID: $ID" ; grep -w $ID $MAILLOG ; done | tail
 
Sorry ment to add the pipe tail to the other one to reduce it's outeput to the most recent, e.g.:
Code:
MAILLOG=/var/log/mail.log ; for ID in $(grep dsn=4.1.8 $MAILLOG|sed "s/^.*sendmail\[[0-9]*\]: \([^:]*\):.*$/\1/"|uniq) ; do echo -e "\nID: $ID" ; grep -w $ID $MAILLOG ; done | tail
That command (copied and pasted) freezes the console.
 
Could you just give the result of:
Code:
grep dsn=4.1.8 /var/log/mail.log|wc -l

Also you may try replacing "tail" with "head" from the former to get todays first occurance of the error.
 

Members online


Top