Here is how I setup mine for gmail: Blackberry Gmail Configuration
To configure IMAP for your Blackberry, just follow these steps:
Enable IMAP in your Gmail settings.
From your BlackBerry home screen, select the Blackberry Set-up icon, then choose Personal Email Set-up. (On older devices, just look for the Personal Email Set-up icon.)
Select Personal Email Set-up.
Accept Terms and Conditions.
On the Email Account Set-up page, enter your Gmail username (including '@gmail.com') but leave the password field blank. Select Next.
You'll see a screen that says 'We are unable to set up your email account.' Select 'I will provide the settings to add this email account,' then Next.
Select 'Internet Service Provider Email (POP/IMAP),' then Next.
Select 'I will provide the settings to add this email account,' then Next.
You'll see 'The BlackBerry Internet Service could not configure [your email] account.' Select 'Provide The Settings' to add email account.
Enter your Gmail username (including '@gmail.com') and your password, then Next.
Enter 'imap.gmail.com' as the email server, then Next.
Below your newly added email address, select Edit.
Select Advanced Settings at the bottom.
Make sure the port is set to '993' and 'Use SSL' is set to 'Yes.'
If your email set-up was successful, there should be a new-messages icon on your home screen labeled with the name of the account. Once you see this icon, follow these steps to ensure proper configuration:
Open the mailbox icon.
Open the menu by pressing the jog wheel or BlackBerry menu button, then select Options.
Select Email Reconciliations.
Confirm the following settings:
Delete On: Mailbox & Handheld
Wireless Reconcile: On
On Conflicts: Mailbox Wins
Check our recommended client settings, and adjust your client's settings as needed.