procmail
[Top] [All Lists]

Re: variable assignment from pipe, multiple lines

2002-01-14 16:53:10
Stefan followed up,

| First off, thank you for your very nice and detailed response,
| there were many things to improve I was not aware of before.

You're very welcome.

| As I understood the man-page the lockfile name was optional and would be
| created automatically .. but reading it again I might have misunderstood.

Procmail can infer a name for a local lockfile in most circumstances where
one is needed, so usually if you get a "no implicit name for lockfile"
error, the answer is to remove the second colon rather than to give a name
for the lockfile.  There are exceptions, but this wasn't among them.

When I suggested,

To see what's really happening, put

LOG="The value of the VACMSG variable is \"$VACMSG\"
" # closing quote is one line down

at that point in your rcfile and see what is logged.

Stefan confirmed,

| yes, this reveals that everything infact is captured.

That's what I figured.

By the way, are you sure that "dc=" should be in there twice?

| Yes, this is the way the ldap directory is set up. The command works
| when ran "standalone" as well, so nothing is wrong there.

OK, good.

However, if your goal is to prepare a return header, just use formail -r
and let formail figure out the To: and From:.  It's very good at that.

| Well, I used that approach when I first started looking at sending
| an automatic reply. The problem however is that formail used
| userid(_at_)mailhost as reply address.

You could plug some text in for the From: line rather than using whatever is
in the incoming To:, something based on $LOGNAME(_at_)$HOST, perhaps.  As you
noted, formail -r doesn't supply a From: but leaves that to the MTA on the
way out.

 echo "$VACMSG" \

| yes! this was the core of my problem; the newlines were expanded and
| interpreted as commands instead of text.

| Now I only need to make sure noone can enter quotation-marks into the
| database, because of the problems it would create. Hmm.. maybe do a quick
| char replacement in the get_vac program.. " -> ' .. but thats inefficient
| because its done many times. better to do it once when the message is set
| to save cycles.

Quotation marks in $VACMSG, at least if $SHELL is bash, shouldn't cause a
problem.

One sure way around it would be to get each user's vacation text as a file
rather than as a string.  Then fill it into the autoresponse with cat rather
than echo.  But I'm getting the feeling that the texts are kept on another
server and fetched as needed, so you'd need to create and remove temporary
files on the machine where procmail is running.  Yecch.

  CACHE=.vacationcache # in $MAILDIR by default, else use absolute path

| The original reason for not doing this was that the users did
| not have any home directory; with all account info (alias/forward etc)
| in the LDAP database, only the mailspool would be kept in the filesystem.

As I read that, I was ready to say just to include the user's name in the
name of the file and keep the caches in some common directory.  Stefan was
already there:

| However, I just got the idea that all of them could be in one
| directory instead.

| I.e. CACHE=/var/spool/vac_cache/cache.$LOGNAME

And you'll notice that I anticipated your changing the path to the cache
file; that's why I stuck in a variable for reference to it not only in the
formail -rD command but also in the name of the regional lockfile.

| Thank you again for your time and effort in this matter.

You're very welcome.

| If you have any idea about how to solve the alias -> account
| From: header, please share it as well :)

Other than plugging it in as I suggested before,

formail -r -I"From: $LOGNAME(_at_)$HOST" -A"X-Loop: $XLOOP" -I"Precedence: bulk"

you'll need to wait for someone else to answer.  I know procmail only as a
user of shell logins and nothing about administering email.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>