Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Removing periods from mailbox names Apps
I've been migrating mail messages to a new Mac mail server from a Windows-hosted one.

Unfortunately, mailboxes with a period ('.') in the mailbox name cause the copy command to error out. One user has about 5,000 mailboxes, so individually removing all the periods by hand was problematic.

I wrote the following AppleScript to remove the periods in each mailbox name for all mailboxes under 'On My Mac.'
tell application "Mail"
 set localMailboxes to every mailbox
 repeat with eachMailbox in localMailboxes
  -- code to test for '.' in mailbox name
  set mailboxName to name of eachMailbox
  -- display dialog mailboxName
  set theDots to offset of "." in mailboxName
  if theDots > 0 then
   set AppleScript's text item delimiters to "."
   set theTextItems to text items of mailboxName
   set AppleScript's text item delimiters to {""}
   set newMailboxName to theTextItems as string
   display dialog "Change mailbox name from " & mailboxName & " to " & newMailboxName & "?" buttons {"Yes", "No"} default button 1
   if button returned of result is "Yes" then set name of eachMailbox to newMailboxName
  end if
 end repeat
end tell

[crarko adds: I haven't tested this one. The script compiles OK; but I don't have any mailboxes with a period in the name (other then the .mbox extension, of course.]
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

Removing periods from mailbox names | 0 comments | Create New Account
Click here to return to the 'Removing periods from mailbox names' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.