procmail
[Top] [All Lists]

Re: Send file - permissions

1998-06-22 08:50:42
Bernard El-Hagin sked,

|       I have an account (this one, actually) which I can't access via
| telnet (or similar means) from outside, but I would like to read
| and *remove* mail from this account using Procmail. My idea is to have a
| Procmail recipe on this account which would do the following:
| 
|  When I send an e-mail with a particular Subject of the form:
| XXXXXXXXXX <mailing list>, where the Xs represent a ten digit number

All right, you've considered the security aspect; do change the number from
time to time, though.

| Procmail responds by sending me the file
| 
| /home/belhagin/mail/<mailing list>
| 
| or if I want my INBOX mail (in other words <mailing list> == INBOX) the
| file would be
| 
| /var/mail/belhagin
| 
| The most important thing is for Procmail to clean up after sending me the
| mail by deleting it at this account.

| Thus my questions are:
| 
| 1) What would a recipe for the above look like?

I've some more questions to ask before I can write some sample code.

| 2) Can Procmail remove files which are on my account if they have the
|    following permissions -rwx---------?

Procmail should be running under your uid.  If it was able to create that
file in that directory and the permissions and ownership have not been
changed in the meantime, it should be able to remove the file.

| 3) Will the removing of INBOX mail pose a special problem? I think that
|    cleaning the INBOX will be a more difficult task than cleaning the
|    mailing list mail, because I can't just rm /var/mail/belhagin while
|    removing /home/belhagin/mail/<mailing list> is no problem.

Yes, it will.  You don't want to rm your inbox; you want to truncate it.

Now, here are my questions:

1. Is a single message from your other account with your password subject
supposed to send *all* waiting mail (all folders and your inbox), or is each
message supposed to specify only one folder (or the inbox), or would you like
to be able to do both?

2. What do you mean by "sending you the file"?  Do you mean that procmail
should email it to another email address that you have?  That's what I'm
going to assume for the rest of these questions.

3. Where should your mail be sent?  To a static address that you can
hard-code, to the reply address of your request letter, or to an address
that you'll put into the text of your request letter?  (I recommend hard-
coding a static address, just in case someone else learns your password
subject and fakes a request.  That way your mail will not go to somebody
else and will not be lost [it will just move to one of your other
addresses].)

4. In what form should your mail be sent to the other address?  Do you
want each folder as a single piece of mail or do you want each message to
remain a single piece of mail and arrive on the destination site as such?

What I'm really thinking is that, if you have cron access on that system,
you're best off setting up something to run from that end and periodically
send its mail to the place where you want to read it.

I'm also wondering why you don't just have procmail forward your mail to the
other address as it comes in.