Showing posts with label mail. Show all posts
Showing posts with label mail. Show all posts

Friday, February 05, 2010

Fixing Slow Snow Leopard Mail

OS X Snow Leopard Mail SMTPMany upgrading Mac users have reported that Mail is "slow" in Snow Leopard 10.6. There are several things you can do to remedy the situation. Here's what you can try, but please make sure you have Time Machine backing up your system, or are running an alternative like SuperDuper! or CarbonCopyCloner.

Reset SMTP Mail

One thing that sharp users observed on Apple's forums was that newly-created Mail accounts were not experiencing the slowness to send, that upgraders were commonly experiencing. You can export your mail, recreate your accounts and re-import everything, but another way to mimic creating a new account is to re-set SMTP credentials. It's a bit voodoo, but it seems to work.

  • In Mail app open Preferences, choose the Account you are having trouble with, and then choose "Edit SMTP Server List" from the "Outgoing Mail Server (SMTP)" drop down, in the Account Information panel.
  • Select the SMTP server you are using, and re-enter its credentials.
  • Click OK to Save.

Do this for all your SMTP servers, and remember you can always use Keychain Access to confirm saved passwords.

Vacuum That Index

Mail keeps an index of your messages in a sqlite database, and you can "vacuum" that index regularly to compact and clean up. This is especially useful if you regularly delete mail, and is well-documented on various Mac-related web sites. Quit mail, then from Terminal, run these commands.

yourhost:~ youruser$ ls -lah ~/Library/Mail/Envelope\ Index

yourhost:~ youruser$ /usr/bin/sqlite3 ~/Library/Mail/Envelope\ Index vacuum;

yourhost:~ youruser$ ls -lah ~/Library/Mail/Envelope\ Index

The bookend "ls" commands just show how large your Envelope Index is in megabytes, so you can see the before and after, when running the vacuum command. The middle sqlite3 command vacuums the index. For reference, recently vacuuming my mail envelope index required about 10 minutes, but reduced its size from about 70MB to about 40MB.

Run Cocktail

And finally for general performance, you should regularly run Cocktail. From Maintain's site:

Cocktail is an award winning general purpose utility for Mac OS X. It is a smooth and powerful digital toolset with a variety of practical features that simplifies the use of advanced UNIX functions and helps Mac users around the world to get the most out of their computers. Cocktail is installed at more than 200 000 computers world wide. The largest part being private individuals, but Cocktail can also be found at large international companies (Puma, Sony), educational institutions (Harvard University, University of Texas) or newspapers (The New York Times, Business Week).

The application serves up a scrumptious mix of maintenance tools and interface tweaks, all accessible via a comprehensive graphical interface. Most of Cocktail's major features are arranged in five basic categories. In addition, a Pilot lets you clean, repair and optimize your system with one click of the button.

Cocktail's Pilot is where you can schedule commands to run. I do a weekly Cocktail run, to reset disk permissions and delete caches. It seems to keep things running smooth, but you should note that for certain system cache resets, you should restart the system afterwards.

At any rate, I hope the above information helps someone out. Enjoy!

Friday, October 30, 2009

Greylisting in Snow Leopard Server, or not

Apple's OS X Snow Leopard Server 10.6 implements Greylisting, an anti-spam technique based on forcing sending SMTP servers to "slow down" before they can deliver. This is great for reducing spam, but it also has the perhaps undesired effect of causing delivery delays. Sometimes really, really loooong delivery delays.

In SLS, when you enable anti-spam in your Mail server (which is postfix), greylisting is automatically enabled. Because there are no readily available manuals on how to use this feature, from Apple, you may want to turn it off. Note that I'm skittish about changing config files like in a normal Unix server in an Apple server, because Apple is known to simply change vast portions of their server products without much notice. It's possible that you'd spend time implementing, and they change the way it has to be done so you have to redo it. Anyway, here's how to disable:

How to Disable Greylisting in Snow Leopard Server

Of course, as implied above, you can stop Greylisting by turning off spam filtering altogether. However, to be more specific and just disable Greylisting, do the following:

  1. From Terminal on the server (ssh'ed in or direct), do "sudo bash" to login as root. Then use nano to edit /etc/postfix/main.cf
  2. Remove the "check_policy_service unix:private/policy" string from the line that starts with "smtpd_recipient_restrictions" near the bottom of the file. Save, and exit nano.
  3. Issue a "postfix reload" to reload the configuration.
  4. Use the "exit" command to quit the sudo bash root shell.

I'm a little miffed that Apple would enable this by default and not implement any easy way to edit the greylists or whitelists. At any rate, you can read a couple articles on greylisting, or just wait for Apple. Time however, waits for no man. :-)

Sunday, May 31, 2009

Restoring Mail, but not via MobileMe Account Backups

Time Machine Mail PlistSo much for MobileMe backing up my Mail account data! I had a another weird crash, which has been plaguing me since I upgraded OS X Leopard to 10.5.7. The crash happens when I wake the computer from sleep, and plug in my firewire then USB hard drives. When the USB hits the socket, sometimes I get the grey screen of death, in which the only way to recover is a hard reset. This happened again today, but this time, the hard reset broke Mail. After booting up, I started Mail and the only account I had was my MobileMe account. My Google accounts were gone.

I thought, ah hah!, I'll recover from MobileMe's copies of my Mail Accounts. No dice. It must have quickly pushed to MobileMe, the change that happened when the system crashed, so syncing MobileMe did nothing to recover. Searching the web a little, I found various information about restoring the entire mail folder and so on, but it turned out that my mail data, in ~/Library/Mail, seemed intact. So, I decided to try to restore my Mail plist file first, from Time Machine backup, and see if that would fix the problem.

How to Restore Mail.app

Here's how I restored it:

  • Close Mail.
  • Plug in the Time Machine drive.
  • Press option while clicking the Time Machine icon in the menu bar, select "Browse Other Time Machine Disks" and choose your Time Machine disk. You can display this icon in Time Machine preferences. Note, if you use Path Finder, a Finder replacement, like I do, start Finder before you do any Time Machine work.
  • Enter Time Machine, and find your last Mail plist backup. In Time Machine, just click a folder or two "back", and see what the date on the file is. The file is ~/Library/Preferences/com.apple.mail.plist where ~ is your home folder.
  • Affirm the overwrite, when the restore process asks if you want to replace the file with an older version.
  • Start Mail.

This worked. All my mail was present and accounted for. If my mail had been damaged, I could do the same procedure, but after stopping Mail, just rename the Mail folder ~/Library/Mail to something else like ~/Library/Mail-Backup, and restore both the Mail folder and the plist file from your Time Machine backup. It will take quite a bit longer to achieve, but it should work.

I hope this helps someone. Enjoy, and good luck recovering.

Friday, October 31, 2008

Address Book vCard to Windows User - Garbled Japanese Fonts etc.

Apple Address Book - Set vCard Format Appropriately for SharingApple's "Address Book" is included with OS X and is part of the "triumvirate" which also includes Mail.app and iCal.app, gives you the ability to drag address cards to Mail, where they are automatically pasted in their vCard, or VCF, form.

Problems Sending vCards to Windows Users

In trying to send VCFs to Windows Outlook users, I discovered two problems by trial and error. First, the Windows users could not open what I was sending even if it was in English, and second, the Japanese fonts in the vCards were garbled. The bottom line? Use Format version 2.1 for the greatest compatibility and set your language accordingly.

Thursday, May 08, 2008

How to - Remove Leopard Wiki Mailing List Spam

If you have group mailing lists set up in Leopard Server, these conveniently link to the Leopard Wiki page for the group. However, spam can sully the look of your page, so you may need to perform some routine maintenance at some point. Here's how you can do this.

SSH to your Leopard Server as admin, then "sudo bash" to log in as root. Navigate to group mailing list folder:

bash-3.2# cd /Library/Collaboration/Groups/itsystems/mailinglist

Use grep to find the mailing list pages with spam. In our example, let's say we have a lot of "spam" messages coming from the FileMaker server - announcement-type messages that have a limited usefulness by nature. These all have, say, the string "FMServer" in them, so we grep this way:

bash-3.2# grep -R "FMServer" *

cb90d083b749806821e589295fa79609.page/page.plist: FMServer Information...
...

Copy the results to the clipboard, then search and replace in a text editor to remove the "/page.plist: " bit. Put "rm -rf" in front of each line, with no double quotes of course, then copy this block of commands to the CLI to execute. Grep again to confirm that the result is nothing:

bash-3.2# grep -R "FMServer" *

Remove the index.db file then restart:

bash-3.2# rm -rf /Library/Collaboration/Groups/itsystems/index.db
bash-3.2# serveradmin stop teams
bash-3.2# serveradmin start teams

You can also do "sudo serveradmin stop teams" if you are not logged in as root. The index.db is created after a few seconds, which you can confirm.

bash-3.2# pwd
/Library/Collaboration/Groups/itsystems
bash-3.2# ls -la
total 6704
drwxr-x--- 12 _teamsserver _teamsserver 408 May 8 12:37 .
drwxr-x--- 6 _teamsserver _teamsserver 204 Apr 1 12:47 ..
-rw------- 1 _teamsserver _teamsserver 3040287 May 8 10:55 backup.mbox
drwxr-x--- 25 _teamsserver _teamsserver 850 May 8 06:42 discussion
-rw-r----- 1 _teamsserver _teamsserver 2074 May 8 08:53 extrainfo
-rw-r----- 1 _teamsserver _teamsserver 377856 May 8 12:37 index.db
drwxr-x--- 18 _teamsserver _teamsserver 612 May 8 12:30 mailinglist
-rw-r----- 1 _teamsserver _teamsserver 1278 May 8 12:37 metadata.plist
drwxr-x--- 2 _teamsserver _teamsserver 68 Apr 1 12:47 public
drwxr-x--- 2 _teamsserver _teamsserver 68 Apr 1 12:47 resources
drwxr-x--- 3 _teamsserver _teamsserver 102 May 8 06:25 weblog
drwxr-x--- 23 _teamsserver _teamsserver 782 May 8 06:42 wiki

Hope this how-to is helpful to someone.

Tuesday, January 01, 2008

Mail.app 3.x in Leopard - Rule to Tag Mail as "Expiring" Takes Advantage of Address Book Groups

As a New Year's project, besides biking a lot up and down along the Sakai River on my new Centurion, I decided to try switching from Entourage 2004 and its monolithic mail store file, to the Mail.app that comes with OS/X Leopard and use Gmail IMAP. One thing I have set up in Entourage is a rule that runs an AppleScript to search a long list of sender email addresses from which comes mail I want to mark as "Expiring". These are newsletters, RSS newsfeed updates and other information that I don't necessarily want to keep, but want an easy way to find for later deletion.

Mail.app's rules work fine, but, once you get past 10 or 15 criteria lines inside a given rule, you cannot add more because the panel being used does not scroll as you can see here. I was going to rewrite my original Entourage script that I was triggering for every message:

tell application "Microsoft Entourage"
   
    set theMsg to item 1 of (get current messages)
    set theAddress to the sender of theMsg
    set theAddressString to the address of theAddress
    set theName to the display name of theAddress
    set theSubject to the subject of theMsg
    set theTargetCategory to category "Expiring"
   
    --List of mail addresses to check
    set fromList to {"postmaster@somedomain.com", "news@bigcorp.com", "announcement@garageco.com"}
   
    if fromList contains theAddressString then
        set category of theMsg to theTargetCategory
    end if
end tell

... and try to use this method for all mail that comes in and is processed by Mail.app. However, it occurred to me that I could simply add all senders to my address book, put the ones I want to mark as Expiring in an Address Book group, then run a rule to check that.

Turns out that Address Book is indeed well integrated and there are rules you can use. In addition, to have the ability in Mail.app to "tag" messages like you can do already in Entourage 2004 via its Categories, the excellent MailTags comes to the rescue, so that you can keyword each message you are marking.

Here are the steps:
  • In Address Book, add a group, say, "Expiring".
  • In MailTags preferences in Mail Preferences, add the keyword "Expiring".
  • In Mail.app, open Mail preferences and open the Rules pane. Add a new rule and give it a name like Expires.
  • If "Any" of the conditions is met, choose "Sender is a Member of Group" and the group name "Expiring".
  • Perform the following actions: choose "Set color of message" "of background" or "of text" and a color to indicate that the message is Expiring.
  • Next action: "Set mailtags keyword" then "Add" then "Expiring".
  • Next action: "Stop Evaluating Rules" if appropriate.
  • Save and test.

Because you have the keyword "Expiring" now in the headers of messages that trigger this rule, you can use a smart folder in Mail.app to view all expiring messages and make a human decision on what action to take - delete or archive.