LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to allowing Unknown Local Recipients with sendmail via smarthosting (https://www.linuxquestions.org/questions/linux-general-1/how-to-allowing-unknown-local-recipients-with-sendmail-via-smarthosting-760007/)

mail4vijay 10-06-2009 04:53 AM

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....

bathory 10-06-2009 06:25 AM

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.

mail4vijay 10-06-2009 09:42 PM

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!

mail4vijay 10-06-2009 11:30 PM

Quote:

Originally Posted by mail4vijay (Post 3710448)
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 unix:passwd.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

bathory 10-08-2009 05:11 AM

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

mail4vijay 10-11-2009 10:28 PM

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.

bathory 10-12-2009 12:49 AM

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

mail4vijay 10-12-2009 08:14 PM

Thanks a lot ,... :hattip: 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....:)

mail4vijay 10-12-2009 08:26 PM

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.

bathory 10-13-2009 12:43 AM

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

mail4vijay 10-14-2009 03:56 AM

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.

mail4vijay 12-12-2009 01:00 AM

Quote:

Originally Posted by mail4vijay (Post 3718607)
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.

bathory 12-12-2009 03:54 AM

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

mail4vijay 12-13-2009 04:36 AM

Quote:

Originally Posted by bathory (Post 3788640)
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...

bathory 12-13-2009 12:01 PM

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


All times are GMT -5. The time now is 11:40 PM.