LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-28-2011, 12:31 AM   #1
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Rep: Reputation: 1
How to restrict users to send mail to outside domains


hi
How to restrict users to send mail to outside domains in qmail server, i have centos and qmail installed


Amar
 
Old 05-28-2011, 04:10 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by amartlk View Post
hi
How to restrict users to send mail to outside domains in qmail server, i have centos and qmail installed


Amar
Mention all your domains in /var/qmail/control/rcpthosts to which user can send mail.
 
Old 05-30-2011, 04:07 AM   #3
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
hi

i already mention doamins in rcphost still it send mail outside


Regards
Amar
 
Old 05-30-2011, 07:27 AM   #4
nidhinmd
Member
 
Registered: Aug 2007
Location: Cochin, Kerala, India
Posts: 32

Rep: Reputation: 3
Add domains names to /var/qmail/control/locals and /var/qmail/control/virtualdomains then restart qmail and check.
 
Old 06-02-2011, 05:53 AM   #5
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
thanks for reply
but still mail are going outside
 
Old 06-02-2011, 07:15 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

You can put a non-existent host in the smtproutes file, so when qmail tries to deliver a message that is not local it fails with a "permanent error"
You may also use queuelifetime to specify the time (e.g. 600) that the message stays in queue before it bounces back (default is 1 week)

Regards
 
Old 06-03-2011, 03:58 AM   #7
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
i add abc in smtproute file and restart qmail but still mail go outside

Regards
Amar
 
Old 06-03-2011, 05:06 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
Originally Posted by amartlk View Post
i add abc in smtproute file and restart qmail but still mail go outside

Regards
Amar
What abc and what smtproute file?
You need sometrhing like:
Code:
:x.x.x.x
where x.x.x.x is the IP of a non existent host, or at least a host that does not run a mail server.
The filename is smtproutes and it's located in /var/qmail/control/smtproutes
 
Old 06-03-2011, 05:38 AM   #9
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Thanks very much

solved , but it does not give any error when i send to external id it just send but not receive on external id and any thing to do to get returned back error


Amar
 
Old 06-03-2011, 06:32 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
You don't pay much attention to replies.
I've already told you, that you need to specify a small amount time in /var/qmail/control/queuelifetime, so yo don't have to wait a week to get the bounce back message.
 
Old 06-11-2011, 12:44 AM   #11
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Hi

i entered 200 in /var/qmail/control/queuelifetime, and when i send message to outside mail i get delivery fail message after 1 week pls help

Regards
Amar
 
Old 06-11-2011, 03:40 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

I don't know what you did, but I've just tested with a queuelifetime of 60sec and it worked, as you can see:
Quote:
2011-06-11 11:10:26.242030500 new msg 4793211
2011-06-11 11:10:26.242033500 info msg 4793211: bytes 510 from <foo@bar.com> qp 2867 uid 1000
2011-06-11 11:10:26.294100500 starting delivery 32: msg 4793211 to remote XXXXX@gmail.com
2011-06-11 11:10:26.294102500 status: local 0/10 remote 1/20
2011-06-11 11:10:29.301976500 delivery 32: deferral: Sorry,_I_wasn't_able_to_establish_an_SMTP_connection._(#4.4.1)/
2011-06-11 11:10:29.301979500 status: local 0/10 remote 0/20
2011-06-11 11:17:07.348944500 starting delivery 33: msg 4793211 to remote XXXXX@gmail.com
2011-06-11 11:17:07.348947500 status: local 0/10 remote 1/20
2011-06-11 11:17:10.358305500 delivery 33: failure:
Sorry,_I_wasn't_able_to_establish_an_SMTP_connection._(#4.4.1)/I'm_not_going_to_try_again;_this_message_has_been_in_the_queue_too_long./
2011-06-11 11:17:10.358309500 status: local 0/10 remote 0/20
2011-06-11 11:17:10.473097500 bounce msg 4793211 qp 2911
2011-06-11 11:17:10.473100500 end msg 4793211
2011-06-11 11:17:10.473648500 new msg 4793225
2011-06-11 11:17:10.473650500 info msg 4793225: bytes 1146 from <> qp 2911 uid 1008
2011-06-11 11:17:10.540737500 starting delivery 34: msg 4793225 to local foo@bar.com
2011-06-11 11:17:10.540740500 status: local 1/10 remote 0/20
2011-06-11 11:17:21.034665500 delivery 34: success: did_1+0+1/
2011-06-11 11:17:21.034668500 status: local 0/10 remote 0/20
2011-06-11 11:17:21.035031500 end msg 4793225
AFAIK qmail tries for the first time to send the message and then retries (every 5mins?) until the queuelifetime expires. Then tries for a last time and bounces back the mail.
Even though there is no need to restart qmail, try to restart it and test to see what happens

Regards
 
Old 06-11-2011, 08:00 AM   #13
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
i kept 200 in /var/qmail/control/queuelifetime, and restart but still not get bounce back i will baunce back after 1 week which is default values i think qmail not take value from queuelifetime need to edit any other files??


Regards
Amar
 
Old 06-11-2011, 01:15 PM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
No, it's queuelifetime that specifies the time a mail stays in queue
What gives:
Code:
/var/qmail/bin/qmail-showctl |grep queuelifetime
Maybe you're doing something wrong. You may try:
Code:
echo 200 > /var/qmail/control/queuelifetime
 
Old 06-13-2011, 02:38 AM   #15
amartlk
Member
 
Registered: Sep 2010
Location: Nagpur India
Posts: 347

Original Poster
Rep: Reputation: 1
Hi
/var/qmail/bin/qmail-showctl |grep queuelifetime

shows output as
queuelifetime: Message lifetime in the queue is 200 seconds.

queuelifetime~: I have no idea what this file does.


and

echo 200 > /var/qmail/control/queuelifetime

shows nothing output

Regards
Amar
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] How to restrict some uses to send mail to outside domains mail4vijay Linux - General 25 04-02-2010 04:24 AM
Restrict user to send mail jeesun Linux - Server 12 10-14-2009 04:40 AM
Restrict users of a domain to send/receive mail from one particular domain tanveer Linux - Server 0 09-02-2007 02:01 AM
sendmail - how to send mail from multiple domains? neocontrol Linux - Server 1 05-14-2007 02:18 AM
Sendmail: How can I avoid some users send mail to outside domains? lordphantom82 Linux - Software 0 11-16-2004 07:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:30 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