LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-06-2009, 04:53 AM   #1
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Rep: Reputation: 33
how to allowing Unknown Local Recipients with sendmail via smarthosting


Hi,

I am using sendmail on CentOS-5 and using 'smarthosting'.I want to allow users to send e-mail for users that are not exists in unix but are with SMART HOST.
Thanks

When i send mail i am getting "USER UNKNOWN ERROR".
Sombody have an idea how to resolve this....
 
Old 10-06-2009, 06:25 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You want your local users to send email to users that don't exist locally, but do exist on smarthost and also be able to send mail each other? If that's the case, then if you have a few users on smarthost, you can use /etc/mail/aliases
Code:
user1: user1@[x.x.x.x]
user2: user2@[x.x.x.x]
where x.x.x.x is smarthost ip. Don't forget to run newaliases afterwards.
If you have more remote users than local, then use /etc/mail/virtusertable (but you have to give also the domain) where you should list all your local users.
Code:
local_user1@domain.com local_user1
local_user2@domain.com local_user2
@domain.com %1@[x.x.x.x]
After that you should rebuild the virtusertable database.
 
Old 10-06-2009, 09:42 PM   #3
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Thanks for the suggestion , Is there any way to automatic checking if some send mail to local mail server it first check if user exist local if not then forward mail to smarthost for delivery, because that user exist in ISP.

For example : abc@example.com sends mail to xyz@example.com
First check :xyz@example.com in local if not then forward mail to asusual
smart host where our domain registered actually and find the users and sendmail to actual receipent.

Is it possible to do something automatic like in windows based mail server Mdaemon.

Thanks for yor great help!
 
Old 10-06-2009, 11:30 PM   #4
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by mail4vijay View Post
Thanks for the suggestion , Is there any way to automatic checking if some send mail to local mail server it first check if user exist local if not then forward mail to smarthost for delivery, because that user exist in ISP.

For example : abc@example.com sends mail to xyz@example.com
First check :xyz@example.com in local if not then forward mail to asusual
smart host where our domain registered actually and find the users and sendmail to actual receipent.

Is it possible to do something automatic like in windows based mail server Mdaemon.

Thanks for yor great help!
Same is possible in postfix , for re-directing unknown local users to smarthost like below.

Mail can be sent two ways: directly to the mail server of the receiver or via the mail server of our provider. The second approach is better, in our case — we'll send all outgoing mail to our provider, letting the provider worry about where to send it. That's why the relayhost argument in the INTERNET OR INTRANET section is important. Its value should be the name of our ISP's mail server:

relayhost = mail.provider.net
In the REJECTING UNKNOWN LOCAL USERS section, uncomment the line:

local_recipient_maps = $alias_maps unixasswd.byname

This defines the location of the list of local users for whom we need to receive mail.

That's all for main.cf.


**** So Can you please provide me settings for sendmail ******

Thanks
 
Old 10-08-2009, 05:11 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

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

If you don't want to use the aliases or virtusertable approach, but want to use a file that contains the (local) users you don't want to relay to the smarthost, then you have to rebuild sendmail.cf using the LOCAL_RELAY and LOCAL_USER_FILE options. You can take a look here about these options.

Regards

Last edited by bathory; 10-08-2009 at 05:14 AM.
 
Old 10-11-2009, 10:28 PM   #6
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Thanks for another solutions ,but i read that doc i am not able to under-stand how to enable this option to use and forward my unknown local users mail to SMART-HOST where that users exists.

Could you please give me the right syntax how to add these lines in sendmail.mc

Thanks in advance.
 
Old 10-12-2009, 12:49 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
You can also arrange to relay all unqualified names (that is, names without @host) to a relay host. For example, if you have a central email server, you might relay to that host so that users don't have to have .forward files or aliases. You can do this using
define(`LOCAL_RELAY', `mailer:hostname')

The ``mailer:'' can be omitted, in which case the mailer defaults to "relay". There are some user names that you don't want relayed, perhaps because of local aliases. A common example is root, which may be locally aliased. You can add entries to this list using
LOCAL_USER(`usernames')

This adds users to class {L}; you could also use
LOCAL_USER_FILE(`filename')
I have never used these options, but from what I can understand from the above, sendmail will send any mail addressed to a username user (i.e. without the trailing @domain.com) to the host defined in LOCAL_RELAY, except those users that exist in LOCAL_USER_FILE.
If you want to use these options, make a backup of your sendmail.mc and sendmail.cf, then add:
Code:
LOCAL_USER_FILE(`/etc/mail/localusers')dnl
define(`LOCAL_RELAY',`smarthost.domain.com')dnl
and rebuild sendmail.cf.

NOTE
It looks like LOCAL_* is deprecated and you can achieve the same thing using LUSER_REALYso any mail to a user that does not exist locally will be sent to the host defined by LUSER_REALY.
Code:
define(`LUSER_RELAY',`mailer:smarthost.domain.com')dnl
 
Old 10-12-2009, 08:14 PM   #8
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Wink

Thanks a lot ,... You are really great man ... I did not get a chance yet to test in my environment but I hope this will definitly work...

Thanks a lot once again for your great help....
 
Old 10-12-2009, 08:26 PM   #9
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
If you do not mind , can you please let me know how to keep a bcc copy of all incoming / outing going mail in sendmail server.
I am using CentOS-5 ( Sendmail + SMART-HOST + fetchmail ) ??

****It is possible in postfix via in main.cf ( always_bcc = admin@example.com ) *****

Any option in Sendmail??

Thanks in Advance.
 
Old 10-13-2009, 12:43 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
If you do not mind , can you please let me know how to keep a bcc copy of all incoming / outing going mail in sendmail server.
I am using CentOS-5 ( Sendmail + SMART-HOST + fetchmail ) ??
I'm not going to answer to this one, because I don't like the idea, but you can take a look here at LQ, as I think that this was answered previously, or use google to search.

Regards
 
Old 10-14-2009, 03:56 AM   #11
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Thanks a lot for all of your help...

I just wanted to make my knowledge in sendmail for this as i know how to take backup for all incoming / outgoing in postfix. I tried to find out this option in LQ / google but could not get through.

Anyways Thanks a lot , recentl i joined this group and got valuable reply from you.
 
Old 12-12-2009, 01:00 AM   #12
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by mail4vijay View Post
Thanks a lot for all of your help...

I just wanted to make my knowledge in sendmail for this as i know how to take backup for all incoming / outgoing in postfix. I tried to find out this option in LQ / google but could not get through.

Anyways Thanks a lot , recentl i joined this group and got valuable reply from you.
Hi,

I back to thi LQ again as i am facing problem to sending unknown local user mail to smarthost. My current settings in sendmail.mc is

define(`SMART_HOST', `[x.x.x.x]')dnl
define(`LUSER_RELAY',`[x.x.x.x]')dnl

When i send mail to unknown local user it shows me sent (OK) status but not actually getting mail at my smarthost server.but when i send mail from sendmail to gmail / hotmail i am getting email.. I thin this user relay settigns is not working for the same domain..


Any help would be really appreciated.
 
Old 12-12-2009, 03:54 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

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

You can try to add
Code:
FEATURE(`preserve_luser_host')
and see if it helps.
Also take a look at the logs to see what happens to your emails
 
Old 12-13-2009, 04:36 AM   #14
mail4vijay
Member
 
Registered: Oct 2009
Location: Delhi
Distribution: CentOS , RHEL
Posts: 214

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by bathory View Post
Hi,

You can try to add
Code:
FEATURE(`preserve_luser_host')
and see if it helps.
Also take a look at the logs to see what happens to your emails
Thanks a lot for reply me again on this query.. I added this line per your settigns.
Quote:
My sendmail.mc

define(`SMART_HOST', `[x.x.x.x]')dnl
define(`LUSER_RELAY',`[x.x.x.x]')dnl
FEATURE(`preserve_luser_host')dnl
and maillog are
Quote:

Dec 13 15:17:41 mailserver sendmail[20834]: nBD9lfLR020834: from=<root@mailserver.ozone.com>, size=360, class=0, nrcpts=1, msgid=<200912130947.nBD9lf9h020833@mailserver.ozone.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 13 15:17:41 mailserver sendmail[20833]: nBD9lf9h020833: to=test@ozone.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30047, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (nBD9lfLR020834 Message accepted for delivery)
Dec 13 15:17:45 mailserver sendmail[20838]: nBD9lfLR020834: to=<test@ozone.com>, ctladdr=<root@mailserver.ozone.com> (0/0), delay=00:00:04, xdelay=00:00:04, mailer=relay, pri=120360, relay=[x.x.x.x] [x.x.x.x], dsn=2.0.0, stat=Sent (OK)
Still i am not getting email at my SMARTHOST server for the same domain.. for unknow local users...even status showing me sent (OK)
Is it require seperate auth settings unknown local users as i did for SMARTHOST...

Last edited by mail4vijay; 12-13-2009 at 04:49 AM. Reason: edit msg
 
Old 12-13-2009, 12:01 PM   #15
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,165
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Does smarthost knows how to handle those emails?
Can you take a look at smarthost's logs to see what happens with your mail?
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forward local mail to another local host using sendmail loopy69 Linux - Server 5 02-26-2008 05:38 PM
disable outbound sendmail for specific To recipients walidaly Linux - Software 1 12-16-2007 10:36 PM
Iptables not allowing raw sockets to send IP packets with non local IP vakulgarg Linux - Networking 0 11-09-2007 02:13 AM
Suse 9.0 Firewall not allowing local access gSalsero Linux - Security 3 04-19-2004 09:24 PM
redhat 9: sendmail port 25 not allowing outside telnet aagha Linux - Networking 4 08-28-2003 11:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:06 AM.

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