Re: [Exim] Running Commands

Top Pagina
Delete this message
Reply to this message
Auteur: Tabor J. Wells
Datum:  
Aan: Joseph Kezar, exim-users
Onderwerp: Re: [Exim] Running Commands
On Thu, Oct 11, 2001 at 12:48:39PM -0400,
Greg Ward <gward@???> is thought to have said:

> First idea: I'm sure it's possible with Exim to setup "vacation"
> messages that don't require editing a user's .forward file, and don't
> require the hoary old "vacation" program at all. Check the Exim spec;
> search for "vacation" in the index. Ditto in the filtering manual. My
> guess is you can do something like this:
>
>   * make a directory /etc/exim/vacation (it could be argued that this
>     belongs in /var: whatever)

>
>   * if a file /etc/exim/vacation/foo exists, that means user "foo"
>     is on vacation; the content of this file is the vacation message

>
>   * when a message is received for user "foo", check to see if
>     /etc/exim/vacation/foo exists.  If so, use Exim's built-in
>     "vacation" message capabilities to send notification to
>     the sender, including the contents of /etc/exim/vacation/foo.
>     Also deliver the message to foo's mailbox.

>
> I'm pretty sure you can do all this in the system filter. ISTR this is
> covered in the filtering manual; see the "mail" command.


This is roughly what I do, although I don't do it in the system filter. If
one of my users creates a file named "vacation.txt" in their home
directory then a vacation message is sent out with the contents of
vacation.txt as the body of the msg.

My transport:

vacation_delivery:
driver = autoreply
subject = "Re: ${escape:${length_50:$header_subject:}}"
file = ${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?homedirectory?sub?(uid=${quote_ldap:$local_part})}{$value}{}}/vacation.txt
log = ${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?homedirectory?sub?(uid=${quote_ldap:$local_part})}{$value}{}}/vacation.log
once = /var/mail/${local_part}/Maildir/vacation.once
once_file_size = 8192
once_repeat = 7d
to = $reply_address
from = $local_part

My director:

vacation:
  driver = smartuser
  condition = "${if or {{match {$h_precedence:} {(?i)junk|bulk|list}} \
                        {eq {$sender_address} {}} \
                        {def:h_List-Owner:}} {no} {yes}}"
  require_files = ${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?uid?sub?(uid=${quote_ldap:$local_part})}}:${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?homedirectory?sub?(uid=${quote_ldap:$local_part})}{$value}{}}/vacation.txt
  transport = vacation_delivery
  senders = "!^.*-request@.*:!^owner-.*@.*:!^root@.*:!^postmaster@.*:\
                    !^listmaster@.*:!^mailer-daemon@.*:!^bounce-.*@.*"
  user = ${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?uidnumber?sub?(uid=${quote_ldap:$local_part})}}
  group = ${lookup ldap{user=\"blah\" ldap:///ou=People,o=example.com?gidnumber?sub?(uid=${quote_ldap:$local_part})}}
  unseen
  no_expn
  no_verify


Sorry for the long LDAP lines. But you should be able to get the idea. The
list/daemon mail checks in the director could probably be improved as well

But anyway this works fairly well for me since my users who can't grasp
telneting to a server and running unix vacation can understand copying a
file to their home directory via Samba shares.

> Then all you have to do is make /etc/exim/vacation writeable by your CGI
> script, and write /etc/exim/vacation/foo when user foo tells your CGI
> script he's going on vacation.


Or possibly use something like suexec or cgiwrap to make your CGI run as
whatever user is logged in creating their vacation message.

Tabor

-- 
--------------------------------------------------------------------
Tabor J. Wells                                     twells@???
Fsck It!                 Just another victim of the ambient morality