Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

SendMail is not worked

I have RedHat Linux 7.2 server with Real IP on the net
From the webmin, I try to send an external email to mmbaba@netways.com, this  email address is real on an external mail server,

Note that :
ServerName is :mylinux
URL of it: http://linux.mynetways.com

the email reforward to my account on linux with the following error:
----------------------------------------------------------

----- The following addresses had permanent fatal errors -----
mmbaba@netways.com
    (reason: 501 5.1.8 <LinuxUser@mylinux.linux.mynetways.com>... Domain of sender
address mostafa@mylinux.linux.mynetways.com does not exist)
----------------------------------------------------------

what is the missing configuration.
0
mmbaba
Asked:
mmbaba
  • 22
  • 18
  • 6
1 Solution
 
ahoffmannCommented:
you have set the domain name (FQDN) of system wrong in the MTA's configuration
0
 
mmbabaAuthor Commented:
I have'nt set FQDN ! from where I can set it?
0
 
ahoffmannCommented:
you used webmin, you should do it there.
Otherwise we need to know which MTA you're using.
0
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

 
mmbabaAuthor Commented:
Sorry You  can clarify what is MTA?
0
 
ahoffmannCommented:
MTA - Mail Transfer Agent (sometimes simply called : mail server software)
0
 
mmbabaAuthor Commented:
Oh, SendMail  (Default setting)
0
 
ahoffmannCommented:
# set following in your sendmail.cf, then restart sendmail

DMmynetways.com
Djlinux.mynetways.com

# please read comments in this file too
0
 
mmbabaAuthor Commented:
Perfect !

the email is reached,

now if I need to send the email from the following perl script:
############
$From='Web@mynetways.com';
open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL <<CORRECT;
Subject: $Subject
To:  mmbaba@netways.com
From:  $From
Reply-To: $ReplyTo

Content-type: text/html

testing
CORRECT
close(MAIL);
############

the script give no error but the mail does'nt reached,

Why my friend !
0
 
ahoffmannCommented:
> the email is reached,
and
> the script give no error but the mail does'nt reached,

what's the truth now? I'm confused.

what does /var/log/messages tell you?
what does /var/log/mail tell you?
what does mailq tell you?
0
 
mmbabaAuthor Commented:
Perfect !

the email is reached,

now if I need to send the email from the following perl script:
############
$From='Web@mynetways.com';
open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL <<CORRECT;
Subject: $Subject
To:  mmbaba@netways.com
From:  $From
Reply-To: $ReplyTo

Content-type: text/html

testing
CORRECT
close(MAIL);
############

the script give no error but the mail does'nt reached,

Why my friend !
0
 
mmbabaAuthor Commented:
Through the webmin the email sendded was reached successfully

but the email sended through the above script not reached

Why ?
0
 
samriCommented:
mmbaba,

I think I have seen this Q somewhere.

Anyway,  could you check the mail queue.  Do a  "mailq".  Try sending the mail thru command line. Ie:

-------------
/usr/lib/sendmail -v mmbaba@netways.com
Subjet: Test

This is a test
.
-------------

End the line with a single dot (.).  Should everything is OK.  You can see the SMTP conversation took place, and if there is any error, you should be able to see that too.

You can check what had happened to your previous mail.  Look in /var/log/maillog.  There should be someting in there.

And I would presume that DNS setting are OK.  There is an MX entries for netways.com.
0
 
mmbabaAuthor Commented:
"...I think I have seen this Q somewhere......"
You are right my self pose a question regarding the slow of the sending mail,
I reinstall the system , now the sending is quickly but through the perl script no mail reach.

this is the result of your suggestion:

# /usr/lib/sendmail -v mmbaba@netways.com
Subject:test
this is a test
.
mmbaba@netways.com... Connecting to mail.netways.com. via esmtp...
220 netways.com ESMTP Sendmail 8.10.2/8.10.2; Mon, 29 Apr 2002 09:53:45 -0400
>>> EHLO linux.mynetways.com
250-netways.com Hello IDENT:KWu60T4Vs60UMQUTFWfbf4gndgq3QMnW@[193.251.166.109], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
>>> MAIL From:<mmbaba@mylinux.linux.mynetways.com> SIZE=28
501 5.1.8 <mmbaba@mylinux.linux.mynetways.com>... Domain of sender address mmbaba@mylinux.linux.mynetways.com does not exist
mmbaba... Connecting to local...
mmbaba... Sent
Closing connection to mail.netways.com.
>>> QUIT
221 2.0.0 netways.com closing connection
You have new mail in /var/spool/mail/mmbaba
0
 
ahoffmannCommented:
oops, see samri's . (dot) comment
0
 
mmbabaAuthor Commented:
Dears, then

I have 2 methods to send mails

1- through the webmin
   Compose> he fill the input box of From by default (after  ahoffmann  ) by : mmbaba@mynetways.com

If I send mail , ===>it reach
  and If I take off the input box of From  ==>the email do not reach

2- through the script ====> he do not reach.
0
 
samriCommented:
mmbaba,

I think I have seen this Q somewhere.

Anyway,  could you check the mail queue.  Do a  "mailq".  Try sending the mail thru command line. Ie:

-------------
/usr/lib/sendmail -v mmbaba@netways.com
Subjet: Test

This is a test
.
-------------

End the line with a single dot (.).  Should everything is OK.  You can see the SMTP conversation took place, and if there is any error, you should be able to see that too.

You can check what had happened to your previous mail.  Look in /var/log/maillog.  There should be someting in there.

And I would presume that DNS setting are OK.  There is an MX entries for netways.com.
0
 
samriCommented:
gee.. sorry for the repeated posts. (blamed it on InterQuick).
0
 
samriCommented:
Watch these two lines;

250-netways.com Hello IDENT:KWu60T4Vs60UMQUTFWfbf4gndgq3QMnW@[193.251.166.109], pleased to meet you
501 5.1.8 <mmbaba@mylinux.linux.mynetways.com>... Domain of sender address mmbaba@mylinux.linux.mynetways.com


I think there is something to do with reverse lookup.  

Another strange this is that the Masquerading doesn't seems to work.

Look a few posts back, there should be a comment by ahoffman's on how to get the masquerading.  I would presume that you machine would be "mylinux", and your domain would be "mynetsys.com", so you might want to add DMmynetsys.com in your sendmail.cf (by default it is left blank - I think).  Make sure you restart sendmail --- most of this thing has been touched by ahoffman's too.

Alternately, you can use the sendmail.mc file in /etc/mail.  Just add a line;

MASQUERADE_DOMAIN(netsys.com)dnl

Detailed info on Sendmail's website.
http://www.sendmail.org/m4/masquerading.html

After that save the file, and do a "m4 sendmail.mc > sendmail.cf.  Remember to make a copy of the original sendmail.cf, just in case, I screwed-up.   I think "make sendmail.cf" might work.

About the DNS issue, make sure your host is defined in the DNS (fwd and reverse entry).  Alternately you could add the entry in /etc/hosts of the remote Relay.  Go for the 1st option just in case you might be sending mail directly out to remote sendmail (and not using any relay).

I hope this should help.

The explanation why your mail went thru via Webmin - I think webmin has it's own MUA (mail User Agent) - just like Mail::Sendmail perl module, which connects directly to the remote Sendmail, and does the delivery for you.  Whereas sending mail from cmd line - you are sending the mail to your local Sendmail which then, connect to remote SMTP to relay the mail.  (Gee... I might have made everybody's confused :)
0
 
ahoffmannCommented:
well, if you can send mail using a standard MUA (like mail, pine, etc.) then this question is fixed.
Sending mails through perl is another question/problem, where the web server is involved too.
0
 
mmbabaAuthor Commented:
dear,  ahoffmann  the aim of my question is to fix the sending mails  through perl scripts but to facilate things I was starting talk about the webmin , to let us sure that the connection with the internet have no problem to sending mails, and the problem is in the configuration trend.

I tied the above , no real  progress happend
0
 
ahoffmannCommented:
just to clarify where we stand:
can you send mail with "mail", "pine", etc., and are they elivered correctly? yes or no
0
 
mmbabaAuthor Commented:
let us focus on sendmail service

my DNS is linux.mynetways.com (I call it externallly as http://linux.mynetways.com)
Local hostname is : mylinux (I call it internally as http://mylinux)

If I send mail I do not know why he respnse as following?

Domain of sender address mmbaba@mylinux.linux.mynetways.com does not exist

I tried putting From:mmbaba@mynetways.com but it generate the some result.

Note: through webmin if I left From section empty it generate the same problem but If I put From:mmbaba@mynetways.com
the email sent successfully .
0
 
samriCommented:
The DNS has this record

in mynetways.com zone;
-----
linux.mynetways.com.   in   a 1.2.3.4
in 3.2.1.in-adrr.arpa. zone;
-----
4          in ptr linux.mynetways.com.

I think what had happened is that when your sendmail tries to connect to remote smtp, the remote server failed to do reverse lookup on your name (since your are using mylinux).

Try to stick to one name, preferably the one already in DNS, and if the entry is yet in the DSN, add one, both for fwd and rev lookup zone.  

* Remember to increase the serial number in the SOA record too.
0
 
mmbabaAuthor Commented:
Sorry in which file?
0
 
ahoffmannCommented:
# is following set in sendmail.cf
DMmynetways.com
Djlinux.mynetways.com

# please post result of:  grep ^DS sendmail.cf
0
 
mmbabaAuthor Commented:
1-Yes they are there.
2-Result:
[root@mylinux etc]# grep ^DS sendmail.cf
DS
[root@mylinux etc]#
0
 
ahoffmannCommented:
please post results of:

sendmail -bv mmbaba@netways.com
echo 3 mmbaba@netways.com|sendmail -bt
echo 6 mmbaba@netways.com|sendmail -bt
0
 
mmbabaAuthor Commented:
bash-2.05$ /usr/lib/sendmail -bv mmbaba@netways.com
mmbaba@netways.com... deliverable: mailer esmtp, host netways.com., user mmbaba@netways.com

bash-2.05$ /usr/lib/echo 3 mmbaba@netways.com|sendmail -bt
bash: /usr/lib/echo: No such file or directory
0
 
ahoffmannCommented:
/usr/lib/echo ? who said this?
Just use echo
0
 
mmbabaAuthor Commented:
[root@mylinux]# echo 3 mmbaba@netways.com|sendmail -bt
bash: sendmail: command not found
0
 
samriCommented:
ahoffmans,

sendmail -bv mmbaba@netways.com <-- this one might failed without full path (I think.).

i'm getting tired of 28kbps dialup :(
0
 
ahoffmannCommented:
mmbaba, please look what you've found yourself, and you posted it also here:
      /usr/lib/sendmail

mmbaba, samri,
I didn't use full paths, 'cause we're in a Linux TA, and a lot of Linux distributions deliver with /usr/sbin/sendmail, while traditional UNIX (Solaris, HP-UX, etc.) come with  /usr/lib/sendmail.
Linux is strange in this :-(
0
 
mmbabaAuthor Commented:
Sorry:

#echo 3 mmbaba@netways.com|/usr/lib/sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> canonify           input: mmbaba @ netways . com
Canonify2          input: mmbaba < @ netways . com >
Canonify2        returns: mmbaba < @ netways . com . >
canonify         returns: mmbaba < @ netways . com . >


#echo 6 mmbaba@netways.com|/usr/lib/sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 6                  input: mmbaba @ netways . com
6                returns: mmbaba @ netways . com
0
 
ahoffmannCommented:
according to postings (and if you did not change the rules in sendmail.cf, which I don't assume:), sendmail works, and delivers mail.

If it delivers locally and not to other domains, it's most likely a DNS problem. unfortunately sendmails default behaviour is to use MX records from DNS, newer sendmail can be tweaked to use /etc/hosts instead.

If you still get some error, please post the command you used verbatim, also post **all** messages verbatim you get, and check your log files (/var/log/{mail,messages} and/or whatever you've setup in sendmail.cf and/or /etc/syslog.conf), post important messages too.
0
 
mmbabaAuthor Commented:
"...please post the command you used verbatim, also post **all** messages verbatim ..."

I agree you that the problem it could be a MX record problem but you can clarify what do you mean in the above sentence.
0
 
ahoffmannCommented:
whcich command did you use to send mail, please post it as you used it (all parameters), and which result you get (mail or not, messages in log files).
Please use copy&paste and do not rewrite commands and messages here, for obvious reason ;-)
0
 
mmbabaAuthor Commented:
I'm testing the issue as following

----------------------------
# /usr/lib/sendmail -v mmbaba@netways.com
From:mmbaba@mynetways.com
Subject:test
this is a test
.
----------------------------
Result:

mmbaba@netways.com... Connecting to mail.netways.com. via esmtp...
220 netways.com ESMTP Sendmail 8.10.2/8.10.2; Mon, 29 Apr 2002 09:53:45 -0400
>>> EHLO linux.mynetways.com
250-netways.com Hello IDENT:KWu60T4Vs60UMQUTFWfbf4gndgq3QMnW@[193.251.166.109], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
>>> MAIL From:<mmbaba@mylinux.linux.mynetways.com> SIZE=28
501 5.1.8 <mmbaba@mylinux.linux.mynetways.com>... Domain of sender address mmbaba@mylinux.linux.mynetways.com
does not exist
mmbaba... Connecting to local...
mmbaba... Sent
Closing connection to mail.netways.com.
>>> QUIT
221 2.0.0 netways.com closing connection
You have new mail in /var/spool/mail/mmbaba
--------------------------------------------
look that he add atomaticaly the following:

<mmbaba@mylinux.linux.mynetways.com>

and I do not know why he take off after @ mynetways.com and replace it by :mylinux.linux.mynetways.com

note: I was sayeing that mylinux is the local host and
My url is http://linux.myntways.com

0
 
ahoffmannCommented:
<
  >>> MAIL   From:<mmbaba@mylinux.linux.mynetways.com> SIZE=28501 5.1.8 <mmbaba@mylinux.linux.mynetways.com>...
  Domain of sender address mmbaba@mylinux.linux.mynetways.com does not exist
>

This tells you 2 things:
1. the Dj is set wrong in sendmail.cf (or you didnot restart the sendmail deamon after changing)
2. connection to netways.com was successful, but it rejects delivering mail 'cause it canot find a mail exchanger (MX) for mylinux.linux.mynetways.com
  this could either be 'cause of 1. (see above), or 'cause there is no MX in you DNS for mynetways.com.
  (BTW, such a behaviour of netways.com is called "relaying denied", sometimes)
0
 
mmbabaAuthor Commented:
"...Dj is set wrong in ...."

my settings is :
DMmynetways.com
Djlinux.mynetways.com

I restart my Server and I'm sure.

".....it canot find a mail exchanger (MX) for mylinux.linux.mynetways.com......"

I forword my research in this target,

do you have a suggestion  regarding that !
0
 
ahoffmannCommented:
silly question: is there more than one Dj in sendmail.cf?

The MX record must be set in your DNS configuration, somthing like_

@ IN MX 50 mail.mynetworks.com.

of course, it must be a primary DNS, so it can be reached always, anywhere, ..
0
 
mmbabaAuthor Commented:
"....is there more than one Dj in sendmail...."

No one time.

regarding MX record, can you guide me in which file I should change ?
0
 
ahoffmannCommented:
> .. which file I should change
check /etc/named.conf where the database files for named reside (directory keyword), then edit the appropriate file, adding a line like from my last comment. Restart named.
0
 
mmbabaAuthor Commented:
dear ahoffmann,

I have a remark, I sent to an account of hotmail and another to the yahoo, and the mail reached successfully, look:

------------
/usr/lib/sendmail -v assem_houmsy@hotmail.com
Subject:testtttt
asdas
.
assem_houmsy@hotmail.com... Connecting to mx06.hotmail.com. via esmtp...
220-HotMail (NO UCE) ESMTP server ready at Tue, 07 May 2002 06:00:56 -0700
220 ESMTP spoken here
>>> EHLO linux.mynetways.com
250-hotmail.com Hello
250-8bitmime
250 SIZE 1572864
>>> MAIL From:<mostafa@mylinux.linux.mynetways.com> SIZE=23
250 Requested mail action okay, completed
>>> RCPT To:<assem_houmsy@hotmail.com>
250 Requested mail action okay, completed
>>> DATA
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 Requested mail action okay, completed
assem_houmsy@hotmail.com... Sent (Requested mail action okay, completed)
Closing connection to mx06.hotmail.com.
>>> QUIT
------------
then the problem it could be not in my sever !

I have an access to the mail.netways.com what can I do  to let it recive mails sended by my local server. ?
0
 
mmbabaAuthor Commented:
dear ahoffmann,

I have a remark, without any change in the MX record, I sent to an account of hotmail and another to the yahoo, and the mail reached successfully, look:

------------
/usr/lib/sendmail -v assem_houmsy@hotmail.com
Subject:testtttt
asdas
.
assem_houmsy@hotmail.com... Connecting to mx06.hotmail.com. via esmtp...
220-HotMail (NO UCE) ESMTP server ready at Tue, 07 May 2002 06:00:56 -0700
220 ESMTP spoken here
>>> EHLO linux.mynetways.com
250-hotmail.com Hello
250-8bitmime
250 SIZE 1572864
>>> MAIL From:<mostafa@mylinux.linux.mynetways.com> SIZE=23
250 Requested mail action okay, completed
>>> RCPT To:<assem_houmsy@hotmail.com>
250 Requested mail action okay, completed
>>> DATA
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 Requested mail action okay, completed
assem_houmsy@hotmail.com... Sent (Requested mail action okay, completed)
Closing connection to mx06.hotmail.com.
>>> QUIT
------------
then the problem it could be not in my sever !

I have an access to the mail.netways.com what can I do  to let it recive mails sended by my local server. ?
0
 
ahoffmannCommented:
> then the problem it could be not in my sever !
what do you mean by server?
  hardware, sendmail MTA, named, ...
If the remote MTA does not check your address, it might be true. If it checks, you need a valid MX in DNS

> .. what can I do  to let ..
first check the logs, then check if it denies relaying.
0
 
mmbabaAuthor Commented:
dear, I find where  should change

from webmin>hardware>Network Configuration >Host Addresses >choose my real IP> change the related hostname from:
mylinux.linux.mynetways.com

to :mynetways.com

and now the out put messages through the command

/usr/lib/sendmail -v mmbaba@netways.com

has as from: myuser@mynetways.com

and the testing is perfect , thanks for your efforts.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 22
  • 18
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now