Mac OS X: Changing How Apple Mail Copies E-mail Addresses

| TMO Quick Tip

The default way to copy e-mail addresses out of Apple Mail doesn’t work well because it copies both the email address and sender’s name, which is probably more than you want or need. Apple doesn’t offer an easy way to change that, but there is a Terminal trick that can do it for you.

In Apple Mail, hovering over an e-mail address that’s in the “To” or “From” field shows a drop-down arrow that you can click to reveal a hidden menu. If you then choose “Copy Address,” well, the address isn’t all that’s copied. Apple, in their infinite wisdom, decided that in Snow Leopard, the information that’s copied looks like this:

Testy McTesterson <extremelytesty@gmail.com>

And that’s completely fine if what you’re doing is pasting the address back into the “To” field of a new message, but it’s pretty frustrating if you need to paste it as text somewhere.

 

This problem indeed makes me testy.

 

To switch this so that the e-mail address alone is all that’s copied (minus the person’s name and the angled brackets), open Terminal (in Applications > Utilities) and paste in the following, then hit Enter:

defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool NO

Then just quit Mail and reopen it, and you’re golden. If you’d like to reverse this behavior back to the default, you can use the command above again, replacing “NO” with “YES.”

Comments

MyRightEye

Thank you!!!

Ndna Jnz

OMG Melissa, you totally rock!  This is the best tip of the month!

Thanks!

Nancy with Bifocals

Melissa, first time in my life I have EVER opened the terminal.  I took the chance (my computer didn’t melt or anything), for this great tip.  Thanks so much.

Melissa Holt

This is the best tip of the month!

You’re welcome. And thank you for the compliment (I’m blushing). smile

And thanks, too, to Nancy with Bifocals!

David Van Nuys

I have been so longing for this!!!!  I’m not a Terminal user either but it WORKED!!!  Thanks!!!

David

furbies

Thank you, Thank you, Thank you, Thank you, Thank you, Thank you!

Daniel Kroc

Wahoooooooo!

You are a winner!

Kind Regards,

Daniel Kroc

MCooper

I thought that it did not work because I pasted into the address field and there were all the brackets. But into a text field, just the email!
Thank you.

grouse

THANKS!!

One of the single most annoying things about Mac and Mail.

I’m forever copying emails into websites, documents etc.

Stunning tip sir. (oops, sorry, ma’am)

James

Mike R

Melissa, that was a stellar tip. I quite understand the completeness of stating how to turn the original behavior back on but, for the life of me, I simply cannot think of a reason I would ever need to as I have ONLY ever needed the actual email address.

Kudos for one of the simplest yet most useful fixes for Mail.

seanieryan

Melissa, you have my undying gratitude. Pint waiting in Ireland for you !!!

Gridmaster

Thanks, very useful for older Mail or OSX versions? I remember this behaviour, but it seems to me that this does not need to be applied anymore in Mail version 4.5, or OSX 10.6.7 (which of the two does the job?), as those/that version(s) pastes the address only by default, except when pasting in a to, cc or bcc field. I suppose Melissa’s command is still useful if you want to do the opposite.

mlvezie

Suggestion: if, most of the time you want email addresses with the name attached, but just every now and then you want just the user@domain part, you can create a very simple Automator application with just a shell script in it. The shell script uses my new best friend, pbcopy/pbpaste as well as an old friend, sed, and contains one line:

echo -n `pbpaste | sed ‘s/^[^<]*<\([^>]*\)>.*$/\1/’` | pbcopy

After copying an email address from Mail, run that, and it will strip off the name portion leaving just the user@domain part.

If you’re curious as to why I did echo -n instead of just pbpaste | sed ... | pbcopy, it’s because sed insists on adding a newline, and the original clipboard contents didn’t include one. Wrapping it in backquotes and echo -n strips the newline.

Also: don’t run this if something else is in the clipboard—if you value it…

Bruce Williamson

No need for the Terminal, as you can do this in Onyx under Parameters:Mail:Misc. Options: Hide the name….

Log-in to comment