Sendmail Fails to send emails from Linux server.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sendmail Fails to send emails from Linux server.
# 1  
Old 08-27-2017
Hammer & Screwdriver Sendmail Fails to send emails from Linux server.

I m using free zoho mail client application (similar to microsoft outlook) on my mobile [android / ios] for all my emails to mohtashim@techx.com

I wish to only recieve emails from my Linux Server details of which are: techx 3.10.0-514.10.2.el7.x86_64 #1 SMP CentOS release 7.3.1611 (Core).

I try the below command to shoot an email from the Linux server to my zoho mail client's mohtashim@techx.com email id but the email does not show in my inbox.
Code:
[mohtashim@techx ~]$ echo "hello" | mail mohtashim@techx.com
You have new mail in /var/spool/mail/mohtashim

As soon as i fire this email command, the logs tail -f /var/log/maillog shows the following msg:

Quote:
Aug 27 22:03:12 techx sendmail[3012]: v7RM3C9k003012: from=mohtashim, size=201, class=0, nrcpts=1, msgid=<201708272203.v7RM3C9k003012@techx.com>, relay=mohtashim@localhost
Aug 27 22:03:12 techx sendmail[3013]: v7RM3Cmr003013: from=<mohtashim@techx.com>, size=439, class=0, nrcpts=1, msgid=<201708272203.v7RM3C9k003012@techx.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Aug 27 22:03:12 techx sendmail[3012]: v7RM3C9k003012: to=mohtashim@techx.com, ctladdr=mohtashim (1010/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30201, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v7RM3Cmr003013 Message accepted for delivery)
Aug 27 22:03:12 techx sendmail[3014]: v7RM3Cmr003013: to=<mohtashim@techx.com>, ctladdr=<mohtashim@techx.com> (1010/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30621, dsn=2.0.0, stat=Sent
When i try mail command i do see the mail for mohtashim user on the Linux server as shown below:

Code:
[mohtashim@techx ~]$ mail
 N 39 mohtashim@techx.c  Sun Aug 27 21:34  19/710
& 39
Message 39:
From mohtashim@techx.com  Sun Aug 27 21:34:12 2017
Return-Path: <mohtashim@techx.com>
From: mohtashim@techx.com
Date: Sun, 27 Aug 2017 21:34:12 +0000
To: mohtashim@techx.com
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
Status: R

hello

I m using smtp.zoho.com to send out emails from the Linux box.

Below are a few important settings from /etc/mail/sendmail.mc

Code:
define(`SMART_HOST', `smtp.zoho.com')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl

Here are the firewall ports i have opened
Code:
[root@techx ~]# netstat -ntlp | grep sendmail
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      1733/sendmail: acce
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1733/sendmail: acce
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      1733/sendmail: acce

telnet smtp.zoho.com <port_number> connects on port 587 and 465 only but does not connect on port 25.

I don't know why i don't receive the mail in my zoho application ?

Can you please help so that i can see the emails from my Linux server to my mobile zoho app ?

Last edited by mohtashims; 08-28-2017 at 05:22 AM.. Reason: Formatting for better readability.
# 2  
Old 08-28-2017
What kind of firewall settings does the linux box have? Is port 25 blocked in any way?
# 3  
Old 09-03-2017
RedHat

Quote:
Originally Posted by jim mcnamara
What kind of firewall settings does the linux box have? Is port 25 blocked in any way?
Can you please suggest how can i check this ?

Last edited by mohtashims; 09-03-2017 at 12:06 PM..
# 4  
Old 09-06-2017
You could try to connect to port 25 in telnet. If you can connect from a different machine, it's obviously not firewalled. If you can't connect even from the same machine, port 25 isn't being listened for.
# 5  
Old 09-06-2017
RedHat

Quote:
Originally Posted by Corona688
You could try to connect to port 25 in telnet. If you can connect from a different machine, it's obviously not firewalled. If you can't connect even from the same machine, port 25 isn't being listened for.
I m able to telnet successfully to port 25,587 & 465 from a remote system.

Code:
[root@techx ~]telnet 45.77.141.129 25
Trying 45.77.141.129...
Connected to 45.77.141.129.
Escape character is '^]'.
220 techx.com ESMTP Sendmail 8.14.7/8.14.7; Wed, 6 Sep 2017 21:09:19 GMT

telnet 45.77.141.1229 587
Trying 45.77.141.129...
Connected to 45.77.141.129.
Escape character is '^]'.
220 Development_Digiklug ESMTP Sendmail 8.14.7/8.14.7; Wed, 6 Sep 2017 21:20:18 GMT


telnet 45.77.141.129 465
Trying 45.77.141.129...
Connected to 45.77.141.129.
Escape character is '^]'.
454 4.3.3 TLS not available: error generating SSL handle
Connection closed by foreign host.

Also, locally all the ports seems to be listening as shown below.

Code:
[root@development_techx ~]# netstat -ntlp | grep sendmail
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      1954/sendmail: acce
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      1954/sendmail: acce
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      1954/sendmail: acce

So, i don't think there is any issue with the firewall.

Can you please tell me what could be the issue with the sending of emails?

Last edited by mohtashims; 09-07-2017 at 04:10 AM..
# 6  
Old 09-06-2017
Hi,

You mention you've got your smart relay configured in sendmail.mc, but I wonder if it's actually gone live in your sendmail.cf (the real config file which is generated from the first one).

Could you see what output you get returned for:

Code:
grep ^DS /etc/mail/sendmail.cf

please (assuming that's the location of your sendmail.cf, naturally) ? Also, have you re-started Sendmail since you put the smart relay in place ?

Just a thought, as a discrepancy between your .mc and your .cf could potentially explain why Sendmail appears to be ignoring your smart relay, so to speak.
# 7  
Old 09-07-2017
RedHat

Quote:
Originally Posted by drysdalk
Hi,

You mention you’ve got your smart relay configured in sendmail.mc, but I wonder if it’s actually gone live in your sendmail.cf (the real config file which is generated from the first one).

Could you see what output you get returned for:

Code:
grep ^DS /etc/mail/sendmail.cf

please (assuming that’s the location of your sendmail.cf, naturally) ? Also, have you re-started Sendmail since you put the smart relay in place ?

Just a thought, as a discrepancy between your .mc and your .cf could potentially explain why Sendmail appears to be ignoring your smart relay, so to speak.

Here is the Output after restarting the smtp service
Code:
[root@development_techx mail]# grep ^DS /etc/mail/sendmail.cf
Output:
DS

Here is how I compile my /etc/mail/sendmail.mc

Code:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

This is how i then restarted the smtp service

Code:
[root@development_techx mail]# service sendmail restart
Restarting sendmail (via systemctl):                       [  OK  ]

This is the command i use to send the email from the same server.
Code:
echo "hello" | mail mohtashim@techx.com

This is what i see in the mail logs.
Quote:
Sep 7 06:52:55 Development_techx sendmail[13635]: v876qtD3013635: from=root, size=204, class=0, nrcpts=1, msgid=<201709070652.v876qtD3013635@techx.com>, relay=root@localhost
Sep 7 06:52:55 Development_techx sendmail[13636]: v876qt3c013636: from=<root@techx.com>, size=438, class=0, nrcpts=1, msgid=<201709070652.v876qtD3013635@techx.com>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Sep 7 06:52:55 Development_techx sendmail[13635]: v876qtD3013635: to=mohtashim@techx.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30204, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v876qt3c013636 Message accepted for delivery)
Sep 7 06:52:55 Development_techx sendmail[13637]: v876qt3c013636: to=<mohtashim@techx.com>, ctladdr=<root@techx.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30635, dsn=2.0.0, stat=Sent
Like i said before the mail is received locally by mohtashim user which can be checked using the mail command but the issue remains. The message is not delivered to the zoho email client configured on my mobile.

Here is the entry for /etc/mail/access

Code:
Connect:techx.com                    RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:development_techx            RELAY
Connect:45.77.141.129                    RELAY
192.168.0.0/24                          RELAY

I am able to receive all other emails but not the ones triggered / send by the server.

Can you please suggest where the problem lies ?

Last edited by mohtashims; 09-07-2017 at 04:13 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to configure mutt to send emails on Linux.?

Hello, I am trying to use mutt in order to send emails. I have installed mutt using yum and pasted some details about it later in the post. When I try to run: echo test | mutt -s "Test Email" user@id.com It doesn't do anything. I dont receive any emails. I have the SMTP details for... (1 Reply)
Discussion started by: vaibhavraj
1 Replies

2. AIX

Sendmail daemon is inactive, but still i can send emails

Hi, I did setup sendmail on one of AIX LPARs. Its working as expected. But, would like to clarify something with you all. I stopped the sendmail daemon on AIX LPAR, now it is inactive(&commented it on /etc/rc.tcpip ). But still, am able to send the emails even after stopping daemon. ... (6 Replies)
Discussion started by: system.engineer
6 Replies

3. UNIX for Dummies Questions & Answers

Emails sent from Linux server are rejected by recipient

Hello i have this longterm issue which im unable to solve, i think this is quite simple issue, i hope you may know the cause It is on CentOS Redhat server with qmail installed. # service qmail status # service qmail start Starting Qmail: # ps aux | grep mail qmails 1688 0.0 0.0 ... (1 Reply)
Discussion started by: postcd
1 Replies

4. Linux

Sendmail takes too long to start and the host is unable to send emails

Hello All, Sendmail takes too long to start and the host is unable to send emails, below are the steps followed, Please let me know if I'm missing anything, is there a debug mode for mailx? # time service sendmail restart Shutting down sm-client: Shutting... (6 Replies)
Discussion started by: lovesaikrishna
6 Replies

5. UNIX for Advanced & Expert Users

mailx Vs sendmail to send internal emails to exchange

Hi Gurus, I have been searching for this around, but sendmail seems complicated and not sure if "mail" command would do, since all what I need to send internal emails from my solaris 10 box to our exchange server. Would the mailx or mail command do ? I tried the : # mailx -s test... (2 Replies)
Discussion started by: aladdin
2 Replies

6. UNIX for Dummies Questions & Answers

Can't configure sendmail to send mails to external SMTP Server

Hi all,I know, that this is very common issue, but I can't find where is the problem... I have Solaris 10 installed.I want to send mail to external SMTP server, like:echo "letter body"| mailx -s "subject" test@test.comBut I donno what kind of changes I have to do in /etc/hosts and sendmail.cf or... (5 Replies)
Discussion started by: nypreH
5 Replies

7. Shell Programming and Scripting

Send email from sendmail on AIX using exchange server as SMTP server

i am new in AIX i am trying to write a script to take a backup for specific files on server to and check error log if backup success send email to administrator , script done except for sending mail , i try to configure sendmail on aix to use our exchange server to send emails but still get error... (0 Replies)
Discussion started by: ahmed_salah
0 Replies

8. UNIX for Dummies Questions & Answers

How do I configure Linux server to be able to send emails internally?

Hi The script: #!/bin/sh #set -x # set admin email so that you can get email ADMIN="myemailaddress" # set alert level ALERT=4 df -HP | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do #echo $output usep=$(echo $output | awk '{ print... (5 Replies)
Discussion started by: wbdevilliers
5 Replies

9. Red Hat

Sendmail fails receiving mail since the IP changed on Redhat Server

Hi, Since i move my Linux Redhat server on another Network with new IP address. WE'RE ABLE TO SEND MAIL OUTSIDE BUT we can not receive any incoming mail. It alway points to the old IP. I updated new IP in /etc/hosts and /etc/sysconfig/network then reboot the system. 10.117.32.20 is an old ip... (3 Replies)
Discussion started by: lamoul
3 Replies

10. Solaris

how to send mails to users on exchange server from sendmail/solaris(mailx)

Hi, Can anyone pls. tell me how to access Active directory from solaris. I am looking at solution by which I can send mail notification from the logs generated by scripts, to the users on Exchange server. I am trying for a Perl-LDAP module , but don't realy know how to go for it (5 Replies)
Discussion started by: ganeshh
5 Replies
Login or Register to Ask a Question