Operating System - Linux
1832473 Members
2738 Online
110043 Solutions
New Discussion

Re: "sendmail" does not send mails

 
Tamer Shaalan
Regular Advisor

"sendmail" does not send mails

Dear All,
I have a problem in my Linux server that runs Bugzilla. Bugzilla does not send any email notifications for users at all. I tried some troubleshooting and it seems that sendmail is not working properly although When I tried to send mail from a mail client (as Kmail), it was successful. When trying to send mail from the shell using sendmail command it always fails. In the same time I had many emails sent to my login and root that indicates mail delivery failure with several reasons (Network is unreachable, Connection refused by mydomain.com). Can any one help? All useful replies will be appreciated with high points.

Tamer.
Success is a journey, not a destination
19 REPLIES 19
Steven E. Protter
Exalted Contributor

Re: "sendmail" does not send mails

Shalom Tamer,

tail -f /var/adm/syslog/mail.log

Try the transaction again and take a look at the log for action.

It appears your server is not getting network connectivity on port 25.

It could be any number of issues including relay not being permitted.

The mail.log file will tell you all you need to know.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Ok SEP. I will try and tell you soon
(TEN) points for you if solved via your responses.

Tamer.
Success is a journey, not a destination
Matti_Kurkela
Honored Contributor

Re: "sendmail" does not send mails

Mail clients like Kmail are known as "Mail User Agents" (MUAs). They are typically configured to send the outgoing email to one specific server (so called Mail Transfer Agent, MTA).

In practice, a MUA can send the mail in somewhat incomplete form (some headers missing and sender addresses not exactly in the "official" form). The site administrator usually configures the "outgoing mail" MTA to be more relaxed with validity requirements for emails coming in from the local network's MUAs.
The MTA will then use the mail routing information in the DNS (so called MX records) to find the recipient's MTA (if the recipient is not local). The MTA can try to access any public MTA in the world, unless specifically configured otherwise.

Sendmail is not really intended to be used as a MUA (although it can be used that way): it is a real MTA. Your site's mail system and firewalls are probably configured to accept emails only if they're sent in a correct way (to stop spamming attempts and email-using MS-Windows viruses).

You should configure your sendmail(s) to send all outgoing mail to the "official" mail server (the same one that your Kmail uses). You should also ensure that all servers that are being used to send emails are properly registered in the DNS system: otherwise other mail servers might classify your emails as a spamming attempt.

This is done by defining a so-called "smart host" to Sendmail: on HP-UX, edit /etc/mail/sendmail.conf and find a line that begins with the characters "DS". Type the name of your mail server immediately after those characters, so that the line becomes something like "DSmailserver.domain.com". After that, stop and restart sendmail:
/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start
MK
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

SEP & Matti,

Thanks for your replies,

please find attached some emails that I had for failure mail deliver. It says "network is unreachable!!!" although the machine can access the Internet very well. w.e.t port 25, I think it is Ok coz i sent via 25 with Kmail. In SLES 9.0m I didn't find mail.log or sendmail.conf but I found /etc/sysconf/sendmail but no line starts with DS as Matti said. the matter that surprising me that this machine was sending emails properly since a while. Alsom if you can give me more info about MTA & MUA, I will be happy. Another thing, at bugzilla configurations, I set the mail delivery method to SMTP (not sendmail) and put my smtp server. for that, I thought even if sendmail has errors, bugzilla should be able to send mail, right?

Thank you very much.

Tamer.
Success is a journey, not a destination
Steven E. Protter
Exalted Contributor

Re: "sendmail" does not send mails

Shalom again Tamer,

This is clearly a network connectivity issue.

You'v not provided enough information about your environment to totally solve the issue, but I'll provide some tools you need to do a good diagnosis.

First: networking.
Is this machine exposed to the public Internet or is it permitted to transmit outside the network on port 25

test

telnet 25

if you get a greeting message, you have outside access.

if you hang resolving the hostname use a numeric ip addresss
telnet mail.yahoo.com 25 (not real)
telnet 192.16.18.6 25 (not real)

If you don't get out, you are not permitted to get out and you need to deal with your firewall or set up mail relay.

If you did get out numeric, you have a hostname resolution problem. To fix that you need an /etc/resolv.conf file with valid DNS name servers to permit you to transmit mail.

More likely you are behind a firewall that does not permit direct traffic outside it. Then you need to talk to network administration (hopefully not you, because if you are network administration you should not need this post) and find out what valid SMTP relay servers are available to you.

Then you modify /etc/mail/sendmail.cf

Change DS

to

DShostname_of_relay server

or

DS
[ip address of relay server]

example:

DSexchangeserver

DS
[192.168.0.10]

Then:

Service sendmail restart

sendmail -v -q

See if mail starts to move.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

SEP,

First of all, really I'm the network administrator. Almost, I did what you told me to do. The machine can access the internet prperly via firewall. name resolution is fine. port 25 is open to send through it. and this what makes me post here. If it is ok for you, I can chat with you via ICQ ,msn or yahoo. you can send it to my public email (tshaalan2@yahoo.com). Any other person are also welcome.

Tamer
Success is a journey, not a destination
Kasper Haitsma
Trusted Contributor

Re: "sendmail" does not send mails

Greetings Tamar,

Network unreachable, can be the result of a failing reverse lookup. Meaning, the receiving_mailserver drops the mail, without letting the sender know it does so, since the receiving_mailserver qualifies the email message as a spam attempt.

A reverse lookup searches DNS for an MX record of the sending system.

Questions therefor:
Are both the From: and sending server "MX_resovable"? I.e. can the sender be mailed from the receiving domain, and can the sending server be reached by email (does it have a valid MX in public DNS)

HTH
It depends
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Kasper,

Thanks for your reply. Please be informed that:

1) This machine is not an email server, it is just a Bugzilla server that I configured to send mail notifications using SMTP and I entered the SMTP address.
2) I can ping my smtp server and I have areply. I think if it was a failed reverse looup, the should fail also, Right?

still need help,

Thanks a lot,

Tamer.
Success is a journey, not a destination
Kasper Haitsma
Trusted Contributor

Re: "sendmail" does not send mails

Hello Tamar,

No,

1) When you use sendmail from the command line, the message is built with local information: the sender, as well as the sending host (MailUserAgent part of sendmail). Next the MAU passes the email message on to the MailTransferAgent part of sendmail, still on the same system. So it will in effexct act as a relay. So for a message to get proper credentials (meaning it will not be rejected by the receiving mail server or any mailserver in between) the local sendmail.cf configuration should be in order.
2)a) what do you mean with "my smtp server", the sending system, which is a smtp server, the next hop from the sending machine (aka relay server), or the receiving mailserver (or that companies mail gateway)
2)b) assuming (dangerous, but therfor I state the I assume) it is the receiving mail (gateway) server, it is nice that you can ping, but this only indicates that there is a physical connection possible (level 0 and 1 of the OSI model) rejecting the email message is a little bit more sophisticated, and happens on aplication level.

The acceptance criteria in place nowadays include the validation (!!) of the sending machine and sender. A corporate mail system will reject an incomming email, when it cannot find a valid MX record for the "sending_domain" (here I mean with sending_domain, either companies mail_domain, e.g. hp.com, or the actual sending mailserver, e.g. smtpx.bbn.hp.com), or sender (e.g. I send from inside the hp.com network domain, as if I send from my yahoo.com domain, since HP and Yahoo! have no email relationship, it is unlikely, that mail originating from Yahoo! will be sent through hp, and therefor will be rejected).

To make a long story longer:
If you want your email message to be recieved, you have to create it in such a manner, that it will be accepted. Most of the times it will be silently rejected, when incorrectly composed, so that spammers do not learn from anti-spamming rules. If you are friends with the receiving side, you might ask for their log file, and see what is wrong with your message.

Often the sending system is not MX resolvable (nslookup -q=mx host/domain_under_investigation) or the sender (From:) does not exist, or has an invalid "domain" (user@system.domain, where system.domain has no MX record)

HTH
It depends
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Hello Kasper,

Really many many thanks for your detailed replies.

I feel that your explanation is very near from the truth. To know the entire story exactly, let me tell you about my network configuration and layout. It is a normal corporate network behind a PIX firewall. My web and mail server are hosted externally with domain (say: mydomain.com). Also, I created an active directory domain with the same name (mydomain.com) and created DNS. In DNS at my registrar, I pointed to my hosting provider. In my local DNS servers, I point to mail and web with their real addresses. This Linux machine has a private IP in my corporate intranet and it has Bugzilla server. Really, Bugzilla sends emails to my users email accounts (user@mydomain.com) [i.e., Bugzilla is sending emails for my mail server]. I mean with SMTP server, the SMTP server that I have at hosting provider that I use when configure Outlook to receive mails (also, I used my ISP SMTP server).

I hope this may help.

Thanks,

Tamer.
Success is a journey, not a destination
Kasper Haitsma
Trusted Contributor

Re: "sendmail" does not send mails

Hello Tamer,

OK, so you have the receiving side covered (and under full control, if I interpret your comments correctly).

I had a look at the attachment you included earlier. with record of undelivery reports. The lines that contain value for this thread are:

----- Transcript of session follows -----
... Deferred: sysdsoft.com.: Network is unreachable
...
From: Tamer Shaalan

So the sender is "tshaalan@sysdzilla.sysdsoft" the question is can this mail address be reached from the target system/mail_domain (sysdsoft.com) You state, that you are inside a companies infrastructure, behind a firewall (not sysdsoft.com I trust), and you send to sysdsoft.com, with a return mail domain of sysdzilla.sysdsoft. If it were inside HP, this would be blocked! You pose as sysdzilla.sysdsoft inside another companies infra.

You need to set up your sending machine, and sender address to be inside the companies infrastructure, and I suggest you use an internal mail relay also, the same system, that KMail uses (probably the companies mailserver).

To acomplish this, the Bugzilla system needs to become a proper member of the companies infra (e.g. sysdzilla.mycompany.com) so that the sender address will be correctly formed. Next if you internally relay (DS parameter in sendmail.cf) through the same server as when using KMail, I guestimate you will be succesfull.

It depends
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Hello Kasper,

I'm back again.

The receiving end [sysdsoft.com] mail server is my company email server that is hosted on the hosting provider server (Linux server). "sysdzilla" is a small and private server inside my corporate network and has a private IP (not real). I understod your note that [sysdsoft.com] mail server must reach (resolve) the sender side [sysdzilla.sysdsoft.com]. Now, I ask what is required to achieve that? In other words, I added an entry for sysdzilla in the global DNS server of my domain (really, using aid from hosting Tech Support). and I pointed it to a real Ip address of another simple machine in my corporate company, but also the connection is refused. What should be done exactly to tell hosting tech support to do in DNS to make [sysdzilla.sysdsoft.com] is resolvable and reachable?

Thanks,

Tamer
Success is a journey, not a destination
Kasper Haitsma
Trusted Contributor

Re: "sendmail" does not send mails

Hello Tamer,

If I understand correctly, both systems are inside the same company?

If so, then you need to speak to the admin of the main mailserver. There can be several reasons for denying connection. The admin can limit access on IP sub-nets, on domains, sub-domains, even on a user level (sending user).

If the sending machine is NOT inside sysdsoft.com domain, you cannot send from sysdzilla.sysdsoft.com over the internet. Since the sending domain is in conflict with the sending host (sysdzilla.sysdsoft.com).

HTH
It depends
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Hello kasper,

No, the sending machine "sysdzilla" is inside my corporate network. the domain sysdsoft.com is hosted in hosting provider. The mail server is of course at hosting provider.

Thanks,

Tamer.
Success is a journey, not a destination
Stuart Browne
Honored Contributor

Re: "sendmail" does not send mails

(NOTE: all commands here are case-sensitive)

On the Bugzilla server, you want to run these commands:

dig mx sysdsoft.com

This will return what host sendmail will be trying to connect to when sending a mail ->

sysdsoft.com. 10800 IN MX 0 sysdsoft.com.
sysdsoft.com. 10800 IN A 207.210.104.162

These two records are what I get. The MX pointing to the A, and the A resolved. Verify that you're hosts file isn't overriding 'sysdsoft.com':

ping -c5 sysdsoft.com

If the IP address that is shown in the square brackets is the same as returned by the dig, then all is good. If not, check your '/etc/hosts' file and make sure you're not overriding the name/ip pair.

If all of this is good, try connecting to it manually:

telnet sysdsoft.com 25

If this works, great! It means it's a sendmail config issue.

Still with us? :) Good.

We need to go look at '/etc/mail/sendmail.mc' and '/etc/mail/sendmail.cf' now, and check some settings.

First of, we'll check for a smart-host:

grep ^DS /etc/mail/sendmail.cf

After this, resolver options and ServiceSwitchFile:

grep ServiceSwitchFile /etc/mail/sendmail.cf
grep ResolverOptions /etc/mail/sendmail.cf

In your environment, both of these should be unset (#O ServiceSwitchFile and nothing after DS).

If these are good, then we'll move on to checking the masquerading:

grep MASQ /etc/mail/sendmail.mc

If any lines *DO NOT* start with 'dnl', then the names mentioned there need to be verified as real, resolvable hosts on the Internet.

Umm, yea. That'll do for now I think. That covers most of the major issues.
One long-haired git at your service...
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Stuart,

Thanks for your reply.

Now, the problem is partially solved. Bugzilla server is now sending email notifications normally. I configured Bugzilla email seetings to use the SMTP of my ISP.

But when I try to send mails from shell using "sendmail" command, it still fails to send and I have a log in (/var/spool/mqueue) that tells that connection is refused by sysdsoft.com.

In my internal corporate network, I installed windows active directory domain of the name sysdsoft.com and setup DNS in both domain controllers machines (I configured sysdzilla server with these DNS). When I ping sysdsoft.com from sysdzilla machine, it gave me the primary domain controller IP address (that is the private address). So, I updated my hosts file with an entry for sysdsoft.com with its real IP.

Now, I'm able to ping and telnet sysdsoft.com and get connected properly.

For "sendmail", I didn't find the file (sendmail.mc) and found (sendmail.cf) in /etc directly (the .cf file contains a phrase that tells not to edit this file but instead edit .mc file).

While editing sendmail.cf file, I didn't find neither ResolverOptions nor MASQ in it.

This means that sendmail doesn't send emails (from shell or when setting Bugzilla to use sendmail as MTA) but Bugzilla send normally using SMTP as MTA.

Thanks a lot,

Tamer Shaalan.
Success is a journey, not a destination
Abdul Kaleem Khan
Occasional Advisor

Re: "sendmail" does not send mails

You need to define following parameter:

define(`SMART_HOST', `your.isps.smtp.server')

You need sendmail, sendmail-cf, m4 rpm's to be able to compile the macro sendmail.mc to generate sendmail.cf file. Editing sendmail.cf directly will not work.
Tamer Shaalan
Regular Advisor

Re: "sendmail" does not send mails

Abdul Kalemm,

Thanks for you,

for defining the SMART HOST, do you mean I write this line in sendmail.cf or .mc file?

second, hot make these rpm's to compile? sorry, but I'm not professional with compilation and Linux Installation.

Thanks,

Tamer Shaalan
Success is a journey, not a destination
Abdul Kaleem Khan
Occasional Advisor

Re: "sendmail" does not send mails

From the above I can see you have following problems(Order changed):

1. You want to make some changes to sendmail.cf file
Don't do that, If you do also it doesn't matter, because it will not come into effect.

2. You are not finding the sendmail.mc file
Download and Install sendmail-cf and m4 RPM packages for your linux distribution ( rpm -ivh senmail-cf*.rpm , rpm -ivh m4*.rpm)

3. You want to use your isp's SMTP

Your machine needs to know which server is the mail server. This is configured in the sendmail.mc file by setting the SMART_HOST statement to include the mail server.

In the example below, the mail server has been set to your.isps.smtp.server(the mail server offered by your ISP)
A) Edit senmail.mc file:
define(`SMART_HOST', `your.isps.smtp.server')

B) Process the sendmail.mc file
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

C) Restart sendmail