Old "aliases" file needs to be converted to cpanel's forwards file...

Hi I'm the new admin at dead.org I just picked this domain up from the last owner and he had a script that would when someone wanted an email forwarder they would fill out a form still viewable from the website (www.dead.org) just click on freemail.

Well I'm not really too concerned with forwarding anymore, as I would like to get a new mail subsection going where users can create there own pop3 accounts and manage em' by themselves such as setting up there own forwarders, auto-responders, etc.

But what does concern me is the previous 1-2k users that are in this (/etc/aliases *nix format) aliases file. I need some type of script to import this aliases file into the cpanels interface for it's forwarding option. I don't know if it's some type of database or what. I'm not good at scripting let alone programming so I thought I would ask here, and see if anyone knew how to interface with cpanels forwarder file.

The aliases file looks like as follows:

aliaschosen: [email protected]
aliaschosen2: [email protected]
aliaschosen3: [email protected]
...
and so on forever!!!

Somehow his previous mail server new that any mail routed to it with one of those alias names would get automatically forwarded to the users [email protected]. I don't really know how to set that up again, let alone import these thousands of emails into the cpanel which is what I would sorda like, that way I could prune the list as I see fit.

If someone is bored and capable and wouldn't mind helping me out I sure would appreciate it.
***Disclaimer*** If you happen to goto http://www.dead.org and you are offended by the content, I don't really have anything to do with that, I'm just the "current" owner/admin for the time being. It's nothing like a rotten.com just some morbid poetry, and information about ways to die, hopefully it will become mostly a poetry site. So try and keep the remarks regarding the site to a minimum ;) thanks

Matthew Holevinski
[email protected]
[email protected]
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
You might need to be patient - it's been a busy 36 hours on these forums ;)

Anyway, on a cPanel server, the aliases are stored in:

/etc/valiases/domain

The format of your aliases file appears to be in the same format as required in the valiases files, so it is probably just a matter of copying the entries in the relevant domains file in /etc/valiases/

Btw, I liked the site :)
 

SarcNBit

Well-Known Member
Oct 14, 2003
1,001
3
168
Don't trust the view count on this board. It does not work correctly :eek:

The aliases are stored in /etc/valiases/domain.tld

This post has an example of how the entries need to appear.

Make sure you search before posting! :)
 

SarcNBit

Well-Known Member
Oct 14, 2003
1,001
3
168
Damn chirpy sneaking in on me! :p

All of our valias files contain 'full address : full address' not just 'alias : full address'. I am unclear if your current file has full addresses or not. I have not tested to see if it works without a full address to the left of the colon.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
SarcNBit said:
Damn chirpy sneaking in on me! :p
Got to keep on your toes in these forums now ;)

I think you might be right in needing a full email address as the first parameter. A simple search an replace on : would easily fix that, though.
 
A find and replace would probably be alittle too difficult

It's true it's not [email protected]: [email protected]
currently the aliases file is just that an alias aliasnick: [email protected]...

I don't believe I have access to that directory because I am indeed an end user on this server my friend who owns the server could place it there but i figure if there is such a way to find/replace the first "<nick>:" before the users emailaddress directly after and append an @dead.org he could probably just pipe the contents of my aliases file into his.

Something about that doesn't sound right though, let's say hypothetically this was my server and my aliases file was in the format of [email protected]: [email protected] and it would be a simple append command to put my aliases into that valias file then would it show up as forwards in the cpanel. (hope that made sense)

You guys rock, thank you so much for the posts, you have been very informative and helpful as well as positive, it's really nice getting those kinda responses.

And to the one gentleman that mentioned he liked the site I appreciate that too, thanks :)
It used to be ran YEARS ago, but was taken offline but I kept the site admins email and mailed him the other day and he was like ya, let's try and get it back up and running so that's what I'm doing, hopefully a re-design won't take us too long.

God what I wouldn't give to be able to program scripts, and macro's, and things of that nature that would be soooooooo nice, I could automate myself right out of a darn job!

I assume since this is the Scripting thread you guys know a thing or two about scripting and programming scripts, just off topic do you think www.elementk.com would be a good place to start with some languages, I've programmed on and off through the years but never seriously, and it was all very broad never focused on just one language so I never specialized. But i'm familiar with coding and compiling and the likes but kinda flustered when it comes to finding a place to start. I figure something like perl in an *nix environment would be the best but still unsure.

Thanks for Everything,
Matt

***EDIT***
Ohh hell!!!! /etc/valiases/domain, okay that sounds right that way the aliases file would be specific to my domain, I guess I have a tendency to glance over stuff. YAY, okay so somehow get this aliases file into that valiases/deadorg directory and I'm homefree given it's in the correct format, and still don't know if it would show up under cpanel's interface in the email forwarding page.
 
Last edited:

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
Hi Matt,
let's say hypothetically this was my server and my aliases file was in the format of [email protected]: [email protected] and it would be a simple append command to put my aliases into that valias file then would it show up as forwards in the cpanel
Yup, that's it. cPanel just reads the contents of that valiases file. I'd ask your admin and give him a lollipop for his efforts ;)

I've been programming for, oooh, around 25 years now (I started young, BTW!). My language of choice now is perl. What language you choose, really does depend on what you want to do with it.

For example, if you want to do MySQL back-end web sites with pretty and powerful front-ends, the PHP might be your choice.

If you want an all purpose language that you can write server back-end scripts and dynamic web comtent, then perl might be a better bet.

If you want to develop client based applications, then there's a wealth of options in Java, C++, VB, and the list goes on.

At the end of the day, a programming language is just a matter of getting the damn PC to do what you want it to. The real skill is learning how to use that language for your own means, which does take time, experience and above all, enthusiasm.

Your greatest source for learning, is other peoples scripts together with a good course on how to program in a language that you would like to use to achieve something with now.

Just my 2p worth.
 

SarcNBit

Well-Known Member
Oct 14, 2003
1,001
3
168
dead.org said:
so somehow get this aliases file into that valiases/deadorg directory and I'm homefree given it's in the correct format
Please do not be confused. The file name would be dead.org and the directory would be /etc/valiases/ :)

You have to make sure that the file is chown'd correctly (accountname.mail) if you are going to replace it. Your server admin should be able to take care of that no problem if they are willing to load the file for you.
 
Comprehension

Ya, I understood you guys perfectly. I didn't repeat it back as well but I understood that /etc/valiases was the dir and dead.org was the file, either way nothing alittle cat aliases > echo > dead.org couldn't solve.
My aliases format was user: [email protected], but I got it fixed to [email protected]: [email protected]. So everything is fine now and working wonderfully..



...
...

Except that who know's how many of these forwards no longer goto valid addresses anymore... Ohh wo-uhz mee.....

Thanks tho'!
Matt