PDA

View Full Version : Automatically forwarding e-mails to NULL...



Keith Larman
03-28-2004, 10:49 AM
I do some work as a reseller. I have a client that periodically wants to redirect all e-mail to a particular e-mail addy they have to basically NULL. They use mojomail and have a large list with a lot of bad addy's. And since they use it only once in a while, rather than them going through and cleaning their e-mail list, they'de rather redirect the "postmaster" messages to null when a mailing goes out. Then turn it back on after that. I'd like to just show them how to do it via the normal site manager interface. Does the site manager interface have something that supports sending e-mails to a "bit bucket" or "Null" device? Something easy for them to implement (and reconfigure back when done)?

wildjokerdesign
03-28-2004, 11:59 AM
The only thing I can think of would be for you to set up an email account that always sends to null in thier account. Then you could tell them that when they wanted to do this all they had to do was set the postmaster account to send to that email account. I think that would be the simplest in th long wrong with what is available in the Site Manager.

FZ
03-28-2004, 01:36 PM
Just to add to what Shawn said, you could set up that e-mail account (the one you would point all postmaster mail to) with a home directory assigned to it, and in that home directory, place a Procmail recipe to delete all incoming mail. Whenever you need incoming mail deleted, name the file correctly (i.e. .procmailrc), and when you don't want e-mail deleted, rename it to something else (e.g. unused.procmailrc). The code that would go in it would be:


:0:
/dev/null

Alternatively, you could change that condition to move mail to a mailbox file (just in case you want to skim over the mail collected before deleting it permanently).

For a long term solution, I would recommend you look into installing Mailman (http://www.list.org) for your client, since it includes automated bounce processing and what-not. I've switched to it from Mojo mail and have never looked back. It's quite an involved installation, etc. but worth it. If you need help with that, let me know.

Keith Larman
03-28-2004, 03:00 PM
Thanks, guys. I'll take a look at it. It was just one of those things that I was hoping I could just create an alias and put a destination of "null" or something like that (meaning the site manager would have something like that supported). Point to the "null" alias when they don't want 'em, point to a real e-mail when they do.

I'll just sit down and do the short procmail instead... Thanks!

Keith

jalal
03-28-2004, 03:11 PM
Well, you can. To build on what Fayez suggested, create an account, lets say 'deadman@mydomain.com' and have that dump the mail to /dev/null as Fayez shows.
And have a good, useful email account, say 'useful@mydomain.com'.

Then you can just use the Site Manager to change the alias to point to deadman when you don't want mail, and point it to useful when you do want mail.

jim
04-27-2004, 12:24 PM
". . set up an e-mail account with a home directory assigned to it . . .
When you say Ďassign a home directoryí do you mean the FTP directory? Does procmail look in the FTP directory for itís script file?

If not, how do I assign a home directory?

I'm sorry to keep asking for help, but I havenít done this before and Iím not sure how itís done.

FZ
04-27-2004, 02:14 PM
When you say Ďassign a home directoryí do you mean the FTP directory?

Yes, when you create a new e-mail/FTP account and follow the "pages/steps" filling in the details, you get to the FTP one where it has a place to specify a home directory for the account.


Does procmail look in the FTP directory for itís script file?

Well, yes and no. There is a global file, which is run against all incoming mail, and there are user/account specific files run against only the mail for the specific/destination account. The global one is: /etc/procmailrc and the user specific ones are: /path/to/homedirectory (e.g. /ftp/pub/username). So, mail for user "johndoe" is first processed by the Procmail "recipes" (as they're called) in the global file, and then by the recipes present in johndoe's home directory (assuming there are any).


If not, how do I assign a home directory?

Answered already: you set up the account with FTP enabled, give it a home directory, and then disable FTP if it is not required. This will keep the home directory "active" but will disable FTP - keep in mind you are NOT restricted to use /ftp/pub/username - you can assign any directory you like. I like to use /home/users/username instead.


I'm sorry to keep asking for help, but I havenít done this before and Iím not sure how itís done.

There is absolutely no need to apologize. We're all here to help each other and learn how to use the VPS efficiently ;)

jim
04-27-2004, 02:59 PM
how do I assign a home directory?
you set up the account with FTP enabled, give it a home directory, and then disable FTP if it is not required. This will keep the home directory "active" but will disable FTP

When I disable the FTP check box it erases the directory text box. I assumed this meant there was no directory assigned. If one is still assiganed there appears to be no way to tell what it is.


keep in mind you are NOT restricted to use /ftp/pub/username - you can assign any directory you like. I like to use /home/users/username instead.
When I try to give it any name other than the default I get an error message saying
Directory /home/users/username is a sub-directory of another user [another username]

FZ
04-27-2004, 03:27 PM
When you disable FTP access for an account, the home directory text box becomes disabled (and is erased, like you say) - this is normal, because the Site Manager assumes you use home directories for FTP uploads/downloads only. However, when you disable FTP, it does not actually touch the home directory at all. It still exists, and is still associated with its account.

There are many ways of telling what the home directory is for a particular user: the easiest is to click "edit" for the account in question, and just keep clicking "next" until you get to the FTP options step - even if disabled, the home directory for that user is still shown, as well as quota usage - or at least that is how it was when I last checked. If this has changed and you can no longer see the home directory assigned, let me know and I'll let you know about the other way to check.

As for your second error, did you try to create a new directory (i.e. one that cannot possibly be assigned to another user)? Try using another location, e.g. /home/accountname. The Site Manager does not let you use directories (or sub-directories) that have already been assigned to another account (but I typed up a workaround for that a while ago).

Let me know if that helps or not.

jim
04-27-2004, 04:13 PM
As for your second error, did you try to create a new directory (i.e. one that cannot possibly be assigned to another user)

Well I got it working. I must had done something while thrashing around that confused the operating system. I created the directory manually, deleted it, and after that the one I wanted to use seemed to work.

And, you're right. When I unchecked the FTP box saved and returned the directory was still visible.

Thanks for all your help.

FZ
04-27-2004, 05:24 PM
No problem. Glad I could help.

Fred
04-28-2004, 12:18 PM
By default 'nobody is aliased to /dev/null so you can just forward accounts to nobody. However, the current GUI won't let you forward an email account to 'nobody'.

Here are two easy ways to work around this:

1 - manually add aliases each time they're needed

telnet/ssh to your server.
type: echo 'desiredaccount:nobody' >> /etc/aliases
type: newaliases

This will forward everything sent to 'desiredaccount' to /dev/null and it updates the GUI properly.

2 - create a new user (say 'junk') in the GUI. Manually edit the alias file to send it to 'nobody' as described above. Now in the GUI you can forward accounts to 'junk'

Keith Larman
04-30-2004, 08:51 AM
Thanks. I'll give that a try...