How to configure sendmail

View: New views
5 Messages — Rating Filter:   Alert me  

How to configure sendmail

by Olivier Nicole-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have this stupide little configuration that I cannot manage to get
working.

I have one machine a.domain.net that I want to be able to deliver
system mail (like cron and so on) with the following rules:

- user1 on a.domain.net has the same username as on domain.net; I
  want that mail sent to user1 is delivered to user1@...;

- user2 on a.domain.net has no corresponding user on domain.net, but
  it has an alias defined; I want to mail sent to user2 is delivered
  to the alias.

- of course, mail addressed to a full address x@... should be
  delivered accordingly, eventually using a mail relay.

I tried using masquerade in submit.mc, user1 is then rewritten as
user1.domain.net, but the alias for user2 is not parsed and user2 is
also rewritten as user2@....

How can I solve my problem?

TIA,
Olivier
_______________________________________________
freebsd-questions@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@..."

Re: How to configure sendmail

by Matthew Seaman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Olivier Nicole wrote:

> Hi,
>
> I have this stupide little configuration that I cannot manage to get
> working.
>
> I have one machine a.domain.net that I want to be able to deliver
> system mail (like cron and so on) with the following rules:
>
> - user1 on a.domain.net has the same username as on domain.net; I
>   want that mail sent to user1 is delivered to user1@...;
>
> - user2 on a.domain.net has no corresponding user on domain.net, but
>   it has an alias defined; I want to mail sent to user2 is delivered
>   to the alias.
>
> - of course, mail addressed to a full address x@... should be
>   delivered accordingly, eventually using a mail relay.
>
> I tried using masquerade in submit.mc, user1 is then rewritten as
> user1.domain.net, but the alias for user2 is not parsed and user2 is
> also rewritten as user2@....
>
> How can I solve my problem?
virtusertable will certainly help with the first case, and it might
help with the second case.  It depends if the alias in the 2nd expands
to multiple recipients (which virtusertable can't do).  virtusertable is
a lot like alias expansion, but with the following important differences:

   * The address match is against both the username and the host part of
     an e-mail address.  aliases only match against the username part.

   * The username part can be wild-carded, and the matched wild text can
     be used to modify the destination address.

   * virtusertable only provides a 1-to-1 mapping -- aliases provide a
     1-to-many mapping.

virtusertable just changes the envelope addresses: it doesn't change any
of the addresses in the mail header so the mail in the first case will
still show 'user1@...' as the destination address when read in
a mail client.  To change that, you could also use genericstable.

        Cheers,

        Matthew

--
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW



signature.asc (267 bytes) Download Attachment

Parent Message unknown Re: How to configure sendmail

by Warren Block :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Olivier Nicole wrote:
> I have this stupide little configuration that I cannot manage to get
> working.
>
> I have one machine a.domain.net that I want to be able to deliver
> system mail (like cron and so on) with the following rules:
>
> - user1 on a.domain.net has the same username as on domain.net; I
>   want that mail sent to user1 is delivered to user1@...;

An alias will do that.

> - user2 on a.domain.net has no corresponding user on domain.net, but
>   it has an alias defined; I want to mail sent to user2 is delivered
>   to the alias.

Creating an alias for a nonexistent user seems to work here.

> - of course, mail addressed to a full address x@... should be
>   delivered accordingly, eventually using a mail relay.

> I tried using masquerade in submit.mc,

I don't edit submit.mc, just <hostname>.mc.

>  user1 is then rewritten as user1.domain.net,

That's the masquerade...  Wait, is that a typo?  Should be
"user1@..."?

> but the alias for user2 is not parsed

newaliases(1) is needed after editing /etc/mail/aliases.  And there is a
bug if you're using 8.0:

http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/139870

> and user2 is also rewritten as user2@....

Masquerade again.  Not clear whether that's what you want.

-Warren Block * Rapid City, South Dakota USA
_______________________________________________
freebsd-questions@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@..."

Re: How to configure sendmail

by Olivier Nicole-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I apologize if I was not clear enough. I answer youe questions and try
to be more clear at the bottom.

> > I have this stupide little configuration that I cannot manage to get
> > working.
> >
> > I have one machine a.domain.net that I want to be able to deliver
> > system mail (like cron and so on) with the following rules:
> >
> > - user1 on a.domain.net has the same username as on domain.net; I
> >   want that mail sent to user1 is delivered to user1@...;
> An alias will do that.

Only I don't want to define an alias for each and every user.

> > - user2 on a.domain.net has no corresponding user on domain.net, but
> >   it has an alias defined; I want to mail sent to user2 is delivered
> >   to the alias.
>
> Creating an alias for a nonexistent user seems to work here.

user2 aliases to an existing account on some other place.

> > - of course, mail addressed to a full address x@... should be
> >   delivered accordingly, eventually using a mail relay.
>
> > I tried using masquerade in submit.mc,
> I don't edit submit.mc, just <hostname>.mc.

I shall try that.

> >  user1 is then rewritten as user1.domain.net,
> That's the masquerade...  Wait, is that a typo?  Should be
> "user1@..."?

Right, that was a typo.

> > but the alias for user2 is not parsed
>
> newaliases(1) is needed after editing /etc/mail/aliases.  And there is a
> bug if you're using 8.0:

Yes I did newaliases and the version of sendmail is the default with
FreeBSD, that must be 8.14.3

> Masquerade again.  Not clear whether that's what you want.

How to configure sendmail on a.domain.net so that:

1) users with an alias defined in /etc/mail/aliases have their
  messages sent to the alias;

2) users with no alias have their mail sent to user@... (same
  username).

It seems that masquerade does the part 2) but users in 1) are not sent
to the alias.

Best regards,

Olivier
_______________________________________________
freebsd-questions@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@..."

Re: How to configure sendmail

by Warren Block :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 9 Nov 2009, Olivier Nicole wrote:

>>> but the alias for user2 is not parsed
>>
>> newaliases(1) is needed after editing /etc/mail/aliases.  And there is a
>> bug if you're using 8.0:
>
> Yes I did newaliases and the version of sendmail is the default with
> FreeBSD, that must be 8.14.3

I mean there is a bug with sendmail not always sending to aliases on
FreeBSD 8.0-RC2:

http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/139870

>> Masquerade again.  Not clear whether that's what you want.
>
> How to configure sendmail on a.domain.net so that:
>
> 1) users with an alias defined in /etc/mail/aliases have their
>  messages sent to the alias;
>
> 2) users with no alias have their mail sent to user@... (same
>  username).
>
> It seems that masquerade does the part 2) but users in 1) are not sent
> to the alias.

Maybe a mail hub setup in addition to the aliases will do what you need.
/usr/share/sendmail/cf/README has more information.

-Warren Block * Rapid City, South Dakota USA
_______________________________________________
freebsd-questions@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@..."