LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-28-2011, 12:31 AM   #1
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
sendmail server


Hello everyone

I have sucessfully configured sendmail in my machine i.e RHEL 5.2 and I am able to sendmails within my box to all the users.
I am using smtp.gmail.com for my smtp server with ip address 192.168.0.195

But now I want to use this machine 192.168.0.195 to act as smtp server for my other linux client machines so that the clients can send mails to each other using this smtp server (192.168.0.195)

Please let me know what changes do I need to make and where to start from?
 
Old 12-28-2011, 02:30 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should add your clients hostnames and/or IPs in /etc/mail/access, like that:
Code:
clientA.domain.com RELAY
x.x.x.x RELAY
After that you need to hash the file to create the access database:
Code:
makemap hash /etc/mail/access < /etc/mail/access
See this and this for more details and options.

Regards
 
Old 12-28-2011, 03:46 AM   #3
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195

Original Poster
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Yes I did that but no success

Once I send a mail I get a success output
Code:
Dec 28 17:58:00 server sendmail[9815]: pBSCS0Ux009815: to=<root@server.example.com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31548, dsn=2.0.0, stat=Sent
but the message is not received at the end.

Let me tell you the domain is not registered. Can you guide me how to register a domain to create my own smtp server?
 
Old 12-28-2011, 05:29 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Once I send a mail I get a success output

Dec 28 17:58:00 server sendmail[9815]: pBSCS0Ux009815: to=<root@server.example.com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31548, dsn=2.0.0, stat=Sent

but the message is not received at the end.
If server.example.com is your sendmail server, you should look at its logs to see what happens. Perhaps it stays in queue because the server does not know where to deliver.


Quote:
Let me tell you the domain is not registered. Can you guide me how to register a domain to create my own smtp server?
what you mean by that? You can create a fake domain, using a private dns for you and your clients, or you need to register a real domain using a registrar.
Then you have to configure the dns server authoritative for that domain (could be yours or your registrars) and add a MX record that points to your mail server.
 
Old 12-28-2011, 05:30 AM   #5
jayakumar01
Member
 
Registered: Nov 2011
Posts: 106

Rep: Reputation: Disabled
Hi,

Few things i had done to divert my traffic to gmail acc

Step1: vi /etc/mail/access
Connect:172.17 RELAY

Step2: vi /etc/hosts

ipaddress fullyqualifieddomainname hostname

Step 3: Check whether ur ipaddress in block list by isp .



.
 
Old 12-28-2011, 07:32 AM   #6
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195

Original Poster
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by bathory View Post
If server.example.com is your sendmail server, you should look at its logs to see what happens. Perhaps it stays in queue because the server does not know where to deliver.

The message output which I posted was from logs
Code:
/var/log/maillog

what you mean by that? You can create a fake domain, using a private dns for you and your clients, or you need to register a real domain using a registrar.
Then you have to configure the dns server authoritative for that domain (could be yours or your registrars) and add a MX record that points to your mail server.
I have configured one DNS server on 192.168.0.195 i.e server.estmail.com with MX record mail.estmail.com and the DNS server is running properly and my client is running on the same dns i.e 192.168.0.195

but still I am not getting positive output

Here is my forward zone file
Code:
#cat estmail.com.zone
$TTL    86400
@               IN SOA  server.estmail.com.             mail.estmail.com.root (
                                        53              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server.estmail.com.
                IN MX           10 mail.estmail.com.
smtp            In A            192.168.0.195
server          IN A            192.168.0.195
www             IN A            192.168.0.195
ftp             IN A            192.168.0.195
Code:
#cat /etc/resolv.conf
search estmail.com
nameserver 192.168.0.195
Now when I send mail from client to 192.168.0.195 here is the log output
Code:
Dec 29 00:20:32 server sendmail[11443]: pBSIoWkr011441: to=<user1@server.estmail.com>, ctladdr=<root@server.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=120303, relay=smtp.estmail.com. [192.168.0.195], dsn=4.0.0, stat=Deferred: Connection refused by smtp.estmail.com.
on the server and client
Code:
#cat /etc/mail/access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
Connect:192.168.0.195                   RELAY
Connect:10.10.10.98                     RELAY <------- client machine(both are in network)
Can you tell me what all changes do I need to do in my sendmail.mc file to send mails from client to server

my current sendmail.mc
Code:
define(`SMART_HOST', `smtp.estmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
(these are the changes which I have done, Do I need to do any thing else?

Or if possible I can switch to postfix but how am I suppose to configure it to use 192.168.0.195 as my smtp server?

Last edited by deep27ak; 12-28-2011 at 08:13 AM.
 
Old 12-28-2011, 08:27 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
IN MX 10 mail.estmail.com.
You have a different MX record (mail.estmail.com), than the one you want to use as a mailserver (I guess it''s smtp.estmail.com).

Quote:
my current sendmail.mc
Code:

define(`SMART_HOST', `smtp.estmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 465')dnl

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
I don't think you need the first 3 lines, as you want to use your sendmail as the smtp server for your network.

Quote:
Dec 29 00:20:32 server sendmail[11443]: pBSIoWkr011441: to=<user1@server.estmail.com>, ctladdr=<root@server.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=120303, relay=smtp.estmail.com. [192.168.0.195], dsn=4.0.0, stat=Deferred: Connection refused by smtp.estmail.com
Could be related to the above. Or you should check if port 25 is listening and there is no firewall blocking access to it.

Regards
 
Old 12-28-2011, 08:43 AM   #8
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195

Original Poster
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
My server was not listeneing to port 587 and 465. I did some changes in sendmail.mc and now its listening to both the ports

Now when I send mails from client machine(10.10.10.98--server.example.com) to server this is the log output which I get
Code:
Dec 29 01:35:48 server sendmail[12465]: pBSK5mjH012465: to=<root@server.example.com>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31556, dsn=2.0.0, stat=Sent
But still I don't receive any message on 192.168.0.195(server.estmail.com)

I did some changes in zone file
Code:
$TTL    86400
@               IN SOA  server.estmail.com.             mail.estmail.com.root (
                                        59              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           server.estmail.com.
                IN MX           10 mail.estmail.com.
smtp            In A            192.168.0.195
server          IN A            192.168.0.195
www             IN A            192.168.0.195
ftp             IN A            192.168.0.195
mail.estmail.com.       IN A    192.168.0.195
This is the return mail which I get
Code:
Date: Thu, 29 Dec 2011 01:35:48 +0530
From: Mail Delivery Subsystem <MAILER-DAEMON@server.example.com>
To: <root@server.example.com>
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

[-- Attachment #1 --]
[-- Type: text/plain, Encoding: 7bit, Size: 0.4K --]

The original message was received at Thu, 29 Dec 2011 01:35:48 +0530
from localhost.localdomain [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<user1@server.estmail.com>
    (reason: 530 5.7.0 Authentication required)

   ----- Transcript of session follows -----
... while talking to mail.estmail.com.:
>>> MAIL From:<root@server.example.com> SIZE=532
<<< 530 5.7.0 Authentication required
554 5.0.0 Service unavailable

[-- Attachment #2 --]
[-- Type: message/delivery-status, Encoding: 7bit, Size: 0.3K --]

Reporting-MTA: dns; server.example.com
Received-From-MTA: DNS; localhost.localdomain
Arrival-Date: Thu, 29 Dec 2011 01:35:48 +0530
So do you want me to change
mail.estmail.com to smtp.estmail.com ???
 
Old 12-28-2011, 09:11 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
So do you want me to change
mail.estmail.com to smtp.estmail.com ???
Now that you have given an A RR to mail.estmail.com it doesn't matter.
But in general, when someone sends an email to user@estmail.com, the 1st thing that is done, is to find the MX RR for that domain and then connect to that host in order to deliver the mail.


Quote:
(reason: 530 5.7.0 Authentication required)
Somehow you have configured sendmail to require authentication in order to relay mail.
If you have a backup of the sendmail.mc that came with your distro, it should work out of the box, with the only minor change:
Code:
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
because IIRC by default it listens only on the local loopback interface
 
Old 12-29-2011, 07:23 AM   #10
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: RHEL 7.x, SLES 11 SP2/3/4
Posts: 1,195

Original Poster
Blog Entries: 4

Rep: Reputation: 221Reputation: 221Reputation: 221
Well I have end up with a result i.e I wont be able to send mails to other linux boxes as my domain is not registered even though they are using same DNS but I am able to send mails to gmail using my smtp server from all the client machines using the same smtp server.

I just mentioned this line in sendmail.mc
Code:
define(`SMART_HOST', `mail.estmail.com')dnl
where mail.estmail.com is MX record in my DNS zone file

so well and good uptill now

Thanks bathory sir and jayakumar for your help

I appreciate alot and HAPPY NEW YEAR
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting sendmail server to Exchange server 2k3 amit_kalipur Linux - Server 0 06-11-2009 08:40 AM
How to configure a sendmail server to act as a relay server deep_jyotsingh Linux - Server 1 07-30-2008 11:12 PM
migration from exchange server to sendmail server sailu_mvn Linux - Software 0 05-18-2006 12:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration