This should be simple, forwarders would go in the ~/.forward file and I could happily edit them all day long - except there is no .forward file.
Where does CPanel store the forwarding settings?
This is a discussion on Forwarding Settings - Where are they stored? in the Shared & Semi-Dedicated forum
This should be simple, forwarders would go in the ~/.forward file and I could happily edit them all day long - except there is no ...
This should be simple, forwarders would go in the ~/.forward file and I could happily edit them all day long - except there is no .forward file.
Where does CPanel store the forwarding settings?
.forward only forwards the mail associated with your primary account. In a "normal" setup, such as the one my school uses, a Unix server (or server farm) would have up to thousands of users with accounts. Each account would have an associated email address (only one address, that is) and the server would respond to one domain name (or multiple domains with the same users on all). In that kind of setup, .forward would work. Here at the school we are switching over to Exchange from our legacy mail systems. Since my mail is now on the Exchange server, I have a .forward file in my Unix account to redirect any mail that goes to that server into my Exchange account.
Unix systems also have a method for setting up aliases so that you can have email addresses that don't resolve to an account. This allows you to set up addresses like postmaster, webmaster, abuse, etc and point them at someone else's account. Generally this is done in /etc/alias for servers running as described above. CPanel does something similar. It puts your aliases in a file inside of /etc/valiases (virtual aliases). The name of the file is your domain name with its extention (such as "interbrite.com"), and there is a separate file for each subdomain and parked/multihosted domain on your account. The only problem is that JailShell prevents you from accessing the /etc/valiases directory.
If you can run cgi scripts under your user ID on your server, either by default (as is the case on my server), or via an scgi-bin folder, then you could access this file through a script. This is because cgi scripts are run under bash as opposed to JailShell and don't suffer from the limitations of JailShell.
Is there something specific you are trying to do that can't be done via CPanel? Just curious...
--Jason
Hi Jason - thanks for the info. It has been a long time since I last messed about with running exim and so I had forgotten the limitations of the .forward fileFor testing purposes I might yet install it on my development box but I would still need to know where CPanel is making those changes.
To answers your question - Yes, I'm writing my own mailing list software and need to be able to create forwarders on the fly via a script. Well at least that is one option that I'm exploring - I have a better, simpler idea at the top of my list![]()
I'm kinda sorta working on something similar (or would be, if I could find the time). One thought that I had was to use curl (or a simple php file() call might even do it) to pass the appropriate fields to CPanel. I did some testing and it worked well, although I'd agree that accessing the valias files directly would be easier and lower in overhead.
--Jason
It could be done that way but in the long run it might not be compatible with future CPanel versions - or easily portable to other systems.
My first and best idea is to have all mailing lists based around a subdomain email address - i.e. @list.domain.com - then you only have to setup the single rule for the catchall on that subdomain (pipe mail to your script). This is much easier and it works too, but I like to explore all the options first![]()
For a similar purpose I tried accessing mine with a PHP-script (the filters actually, not the forwarders). It unfortunately failed. Apperently it did not run under a user-ID with write access there.
Therefore I went for a method that is even a tad more indirect: the backup files. Download the backup for the one you wish to modify. Unpack it. Make the changes. Repack it. Upload the backup again. Clumsy, but it works.
Regards,
Wim Heemskerk
---
Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
And Gwaihir.net - The Middle-earth CCG store
PHP runs as nobody. The files are owned by you with group permission set to either "root" or "mail" (I forget which) so that the system can access them too. But nobody can't access them. If you try tpo access them via CGI, which on some servers runs under your User ID, then you might have better luck.
--Jason
Copyright © 2011 JaguarPC.com
Bookmarks