LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to send mails on local network from one computer to another computer (https://www.linuxquestions.org/questions/linux-server-73/how-to-send-mails-on-local-network-from-one-computer-to-another-computer-4175438261/)

suresh.k 11-22-2012 05:45 AM

how to send mails on local network from one computer to another computer
 
Hi,

How to send mail's in local network from one computer to another computer.

I have configured sendmail and dovecot in both computers,
both are in same domain,

my access(/etc/mail/access.cof) file configuration is same in both computer's i.e
Connect:suresh.com RELAY

Computer one :-
Hostname : admin.suresh.com
username : shiva

Computer two :-
Hostname : desktop4.suresh.com
Username : ramesh

Here I can send mail's in both computer's for their respective user's only, but I am unable to send mail from 1st computer to user of second computer.


Example's of how I am sending mail to different computer's
[root@suresh] mail -s "test" shiva@admin.suresh.com ----- working fine
[shiva@suresh] mail -s "test" root@admin.suresh.com ------ working fine

[root@suresh] mail -s "test" ramesh@desktop4.suresh.com ----- not working


Thanks
Suresh

unSpawn 11-22-2012 05:56 AM

So what does /var/log/maillog or equivalent say?

suresh.k 11-22-2012 06:37 AM

[root@admin log]# tailf /var/log/maillog

Nov 22 18:06:34 admin sendmail[11361]: qAMCaY9j011361: from=root, size=67, class=0, nrcpts=1, msgid=<201211221236.qAMCaY9j011361@admin.suresh.com>, relay=root@localhost
Nov 22 18:06:34 admin sendmail[11362]: qAMCaYmw011362: from=<root@admin.suresh.com>, size=358, class=0, nrcpts=1, msgid=<201211221236.qAMCaY9j011361@admin.suresh.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Nov 22 18:06:34 admin sendmail[11361]: qAMCaY9j011361: to=rajesh@desktop4.suresh.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30067, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (qAMCaYmw011362 Message accepted for delivery)
Nov 22 18:06:34 admin sendmail[11364]: qAMCaYmw011362: to=<rajesh@desktop4.suresh.com>, ctladdr=<root@admin.suresh.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120358, relay=desktop4.suresh.com. [192.168.10.201], dsn=4.0.0, stat=Deferred: Connection refused by desktop4.suresh.com.

unSpawn 11-22-2012 06:51 AM

Quote:

Originally Posted by suresh.k (Post 4834728)
Nov 22 18:06:34 admin sendmail[11361]: qAMCaY9j011361: to=rajesh@desktop4.suresh.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30067, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (qAMCaYmw011362 Message accepted for delivery)
Nov 22 18:06:34 admin sendmail[11364]: qAMCaYmw011362: to=<rajesh@desktop4.suresh.com>, ctladdr=<root@admin.suresh.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120358, relay=desktop4.suresh.com. [192.168.10.201], dsn=4.0.0, stat=Deferred: Connection refused by desktop4.suresh.com.

So what does maillog say on desktop4.suresh.com?

suresh.k 11-22-2012 06:58 AM

Quote:

Originally Posted by unSpawn (Post 4834742)
So what does maillog say on desktop4.suresh.com?

Nothing,
Not generating any log's on /var/log/maillog of desktop4.suresh.com

unSpawn 11-22-2012 07:26 AM

Can you telnet to 192.168.10.201 and make it accept a message from the command line?

suresh.k 11-22-2012 08:27 AM

Quote:

Originally Posted by unSpawn (Post 4834765)
Can you telnet to 192.168.10.201 and make it accept a message from the command line?

[root@admin ~]# telnet 192.168.10.201
Trying 192.168.10.201...
telnet: connect to address 192.168.10.201: Connection refused

unSpawn 11-22-2012 08:35 AM

Is the MTA running?
Else check the firewall?

suresh.k 11-22-2012 08:38 AM

Sorry..
at that time telnet server was not installed on desktop4.suresh.com.. so i installed it now
it was working now


[root@admin ~]# telnet 192.168.10.201
Trying 192.168.10.201...
Connected to 192.168.10.201.
Escape character is '^]'.
CentOS release 5.5 (Final)
Kernel 2.6.18-194.el5 on an i686
login: ramesh
Password:
Last login: Thu Nov 22 21:20:01 from admin.suresh.com
[ramesh@desktop4 ~]$

suresh.k 11-22-2012 08:41 AM

Quote:

Originally Posted by unSpawn (Post 4834818)
Is the MTA running?
Else check the firewall?

MTA is running fine
and firewall is disabled on both computers

unSpawn 11-22-2012 09:07 AM

Quote:

Originally Posted by suresh.k (Post 4834821)
at that time telnet server was not installed on desktop4.suresh.com.. so i installed it now

OK, please remove the telnet server package. I should have spelled out you telnet from admin.suresh.com to desktop4.suresh.com on port TCP/25 to test if the MTA can be contacted and if it accepts a message:
Code:

]$ telnet desktop4.suresh.com 25
EHLO jilaiya
MAIL FROM: ravana@admin.suresh.com
RCPT TO: kali@desktop4.suresh.com
DATA
SUBJECT: I am son of Comander of Army [ NOT SPAM] of former Presdent of Countyr, who crashed with car, and have busenes oppertuneteh for yous! Makeh Moneys now!!!!
.
QUIT


suresh.k 11-22-2012 09:25 AM

Quote:

Originally Posted by unSpawn (Post 4834844)
OK, please remove the telnet server package. I should have spelled out you telnet from admin.suresh.com to desktop4.suresh.com on port TCP/25 to test if the MTA can be contacted and if it accepts a message:
Code:

]$ telnet desktop4.suresh.com 25
EHLO jilaiya
MAIL FROM: ravana@admin.suresh.com
RCPT TO: kali@desktop4.suresh.com
DATA
SUBJECT: I am son of Comander of Army [ NOT SPAM] of former Presdent of Countyr, who crashed with car, and have busenes oppertuneteh for yous! Makeh Moneys now!!!!
.
QUIT


Ok
Removed telnet-server from both admin.suresh.com and desktop4.suresh.com and then tried to connect telnet from admin.suresh.com to desktop4.suresh.com with port 25

[root@admin ~]# telnet desktop4.suresh.com 25
Trying 192.168.10.201...
telnet: connect to address 192.168.10.201: Connection refused

unSpawn 11-22-2012 09:44 AM

Quote:

Originally Posted by suresh.k (Post 4834857)
telnet: connect to address 192.168.10.201: Connection refused

Is that the only line it returns or does it also say "telnet: Unable to connect to remote host: Connection refused" after that?

Now log in to desktop4.suresh.com, be root and post the output of:
Code:

pgrep -lf sendmail
pgrep sendmail|while read P; do lsof -Pwlnp $P -ai; done
# or: netstat -antlpe|grep sendmail
grep ^O.*Addr= /etc/mail/submit.cf /etc/mail/sendmail.cf


suresh.k 11-26-2012 12:18 AM

Quote:

Originally Posted by unSpawn (Post 4834869)
Is that the only line it returns or does it also say "telnet: Unable to connect to remote host: Connection refused" after that?

When i am trying to connect telnet to desktop4.suresh.com from admin.suresh.com it is showing only
Trying 192.168.10.201...
telnet: connect to address 192.168.10.201: Connection refused,
But when trying to connect telnet from desktop4.suresh.com to admin.suresh.com it is showing
telnet: connect to address 192.168.10.53: Connection refused
telnet: Unable to connect to remote host: Connection refused

Quote:

Now log in to desktop4.suresh.com, be root and post the output of:
Code:

pgrep -lf sendmail
pgrep sendmail|while read P; do lsof -Pwlnp $P -ai; done
# or: netstat -antlpe|grep sendmail
grep ^O.*Addr= /etc/mail/submit.cf /etc/mail/sendmail.cf


[root@desktop4 ~]# pgrep -lf sendmail
2282 sendmail: accepting connections
2290 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue

[root@desktop4 ~]# pgrep sendmail|while read P; do lsof -Pwlnp $P -ai; done
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sendmail 2282 0 4u IPv4 7446 TCP 127.0.0.1:25 (LISTEN)

[root@desktop4 ~]# netstat -antlpe|grep sendmail
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 7446 2282/sendmail: acce

[root@desktop4 ~]# grep ^O.*Addr= /etc/mail/submit.cf /etc/mail/sendmail.cf
/etc/mail/submit.cf:O DaemonPortOptions=Name=NoMTA, Addr=127.0.0.1, M=E
/etc/mail/sendmail.cf:O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA

Thanks
Suresh

unSpawn 11-27-2012 05:58 AM

Quote:

Originally Posted by suresh.k (Post 4836987)
Code:

[root@desktop4 ~]# pgrep -lf sendmail
2282 sendmail: accepting connections
2290 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue


So sendmail processes are running, except...


Quote:

Originally Posted by suresh.k (Post 4836987)
Code:

[root@desktop4 ~]# pgrep sendmail|while read P; do lsof -Pwlnp $P -ai; done
COMMAND  PID    USER  FD  TYPE DEVICE SIZE NODE NAME
sendmail 2282        0    4u  IPv4  7446      TCP 127.0.0.1:25 (LISTEN)

[root@desktop4 ~]# netstat -antlpe|grep sendmail
tcp        0      0 127.0.0.1:25                0.0.0.0:*                  LISTEN      0          7446      2282/sendmail: acce


only the Mail Transport Agent (MTA) listens and not the Mail Submission Agent (MSA), plus the MTA has a default configuration because it only listens on the loopback device...


Quote:

Originally Posted by suresh.k (Post 4836987)
Code:

[root@desktop4 ~]# grep ^O.*Addr= /etc/mail/submit.cf /etc/mail/sendmail.cf
/etc/mail/submit.cf:O DaemonPortOptions=Name=NoMTA, Addr=127.0.0.1, M=E
/etc/mail/sendmail.cf:O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA


...which its configuration confirms. Sorry for the late reply but you need to add two lines to /etc/mail/sendmail.cf: one for the MTA to listen on the LAN IP plus one for the MSA (DaemonPortOptions=Port=submission).


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