Here are a few tips to not get banned.
1) Use different ip addresses for bots and main. Use a proxy, or reset your modem/router when logging from bot to main.
2) This may seem obvious but don't use similar username/pass for main and bot accounts.
3) When transferring gold. You can set up an item with however much price as the amount you wish to transfer, on the AH, with your main. Then have your bot account buy it. (ie, let your main sell a broken arrow for 20mil on the ah, then get your bot to buy it). You lose a bit of money to the AH this way, but it's safer than mailing.
4) Don't bot one boat too frequently.
5) If you really like your main, don't bot. There's always a risk no matter what you do.