Mail.app’s From Address Bug
John Cleary has noticed
a fairly rare but annoying bug in the way that Mail.app handles From: email addresses.
As he points out:
In Mail.app (the standard mail client on OS X), if the person sending an email to you hasn’t specified a ‘from name’ in their email client (or webmail), the email will show up as being from their raw email address even if their name and email address is in your Address Book. Additionally, if the person has specified a ‘from name’ different from their real name (i.e. a nickname or screen name) then that will show up in the from column.
So you get odd things like this:

Obviously this is visually annoying and sometimes less than informative.
It also throws a spanner in the works when sorting emails by name.
John suggests that the solution is easy:
The Mail User Interface needs the ability to choose either to use Address Book names when there is no supplied ‘from name’ or to always use Address Book names regardless of supplied from name, matching instead on the email address.
It makes you wonder why is hasn’t been fixed.
Similar Posts:
- AppleScript to clean up Address Book
- Snail Mail 1.5: Slick Address Book Envelopes
- “Show Emails from” Script for Address Book
- Cleaning up Mail’s Previous Recipients List
- Address Book and nicknames: three work-arounds
Tags: annoyances, Apple Mail, bugs, From addresses, mail.app, sorting

September 24th, 2006 at 11:57 pm
“Rare”? It happens to me all the time, e.g. for a friend of mine who I’ve registered with full details in the address book with her complete (and fairly long) family name, but likes to use in email only a short nickname.
I thought that everyone knew about this, and it was considered “a feature”.
September 25th, 2006 at 12:01 am
Um, this is a bug? I guess it is if one assumes that everyone uses Address Book for names and addresses. Personally I don’t nor do I want to see Apple make this mandatory. I already have enough trouble with iCal not allowing me to add invitations sent to mailing lists because the list isn’t in Address Book.
I’d rather they remove the Address Book hurdle from iCal than spend time on this nit.
September 25th, 2006 at 12:21 am
Hey guys, I’m the John mentioned in article. If you read the quote, it’s clear that this should be added as an option.
It most definitely is a bug in situations where there is no specified ‘from name’. Thus it should be an option to use address book names in this case. But why stop there? It should also be an option to always use Address Book names (or maybe even ‘nickname’ fields if they are there, and then full names). Heck, there are many options here as to how it could be implemented, but the current Mail.app is seriously limited. And that frustrates me. :P
John
September 25th, 2006 at 12:58 am
@Jay – It would be interesting to know how many mail.app users also use Address Book. My guess would be 90-95%. What do you think?
September 25th, 2006 at 6:01 am
@Tim…no idea, really. I’ve never been keen on Address Book and haven’t had the need since mail.app does a good job of caching the names/addresses of people I’ve corresponded with. For in-house addresses I use LDAP.
@John…a feature request, yes. An actual bug? No.
September 25th, 2006 at 9:22 am
@Jay
It’s not a feature request in my opinion. Look at iChat and the way it displays names from Address Book. I think the functionality for displaying names at the moment is broken when there is no from name.
Also, I don’t rely on Mail.app’s address caching, i’ve lost ‘recent addresses’ lists too many times in the past to trust it.
But I agree, a lot of people just use that. But I have too many clients with multiple email addresses (and they often have slightly different ‘from’ name on each) which makes determining rules etc. hard. I definitely think it’s a bug.
September 25th, 2006 at 1:04 pm
I would think this should be an option for users. The way Adium implemented their addressbook integration is great. You can opt for it to use nicknames/alias provided by users themselves or names in your addressbook. It’ll be nice to have this behavior in Mail
September 25th, 2006 at 2:55 pm
I think I would not turn on this feature, because I want to see the email as it was sent and not have Apple Mail tinker with it.
Just imagine you had a faulty (or evil) entry for this person in your address book – and then you hit the reply button, and the quoting section would start with that compromising name displayed in your actual reply message. That would be embarrassing.
“It also throws a spanner in the works when sorting emails by name.”
Try to search for the email address in Spotlight instead.
September 25th, 2006 at 2:59 pm
Ok, two things.
1: it uses the sender’s specified ‘from name’ in the reply, so you’re safe.
2: searching by spotlight on an email is great if people only have one email address. What if i want to see all emails from someone’s work & home accounts cause I can’t remember which one they sent it from?
john
September 25th, 2006 at 3:45 pm
@john
1. But then it would break your logic again. “What, I was replying to John Doe and now it says jdnicknack in the mail?”. Or maybe you forwarded the mail to your friend and he will insist that he cannot find a mail from John Doe, even though he searched for it 3 times until you realize that the mail probably wasn’t really what Apple Mail showed you it was.
2. That’s a problem with Spotlight, because you cannot put an OR in (or can you?). Chances are this guy has some parts in his email address or maybe his signature that is similar across all his mails, so you might be able to search for “doe” and find all mails from john.doe@yahoo.com and doe@asdf.com and all mails signed with doe (and all mails that talk about doe, too).
But I know that problem, too. When I sell something on ebay, and I want to find one buyer’s mail again, I usually have to search 3 times: by last name, by email, by nickname (because Spotlight doesn’t search in Reply-To:, which is a bug!). But I wouldn’t put that guy into my address book. I think it also depends on what share of your mail comes from strangers or people you rarely talk to.
September 25th, 2006 at 3:58 pm
@Tom -
Personally, if i were designing the app i’d make the reply show the email address. I think it’s more use than showing a name that doesn’t make any sense. Or do what Entourage lets you do and specify the whole ‘quote’ line.
The lack of complex queries in Mail.app is indeed frustrating. I mean, seriously, how hard would it be to implement?
Oh, and if you friend can’t find an email you forwarded to him, he’s probably not the sort of user that the program should be designed around. There’s an important distinction between keeping software easy to use and hindering the majority of users in my opinion. And seeing as it should be an option, I simply cannot understand the level of negativity towards this option.
To be blunt, I’m disappointed with the amount of negative responses here from people that are obviously Apple power users. All I’m suggesting is that they fix one small bug (the lack of display of any name when no from name is provided) and add one small optional feature (the ability to use your address book data instead of the sender’s data). And yet everyone is saying ‘it’s not a bug’ or ‘its not a good feature’.
Maybe I’m just too demanding from my software? Does anyone agree with me? Does wasting time finding out which of the 4 Toms that I know sent me a message (by having to open it) annoy anyone else?
john
September 25th, 2006 at 4:00 pm
P.S. think about how iChat works. It displays the person’s name and not their screen-name. Are you all suggesting a return to screen-names would be better?
September 25th, 2006 at 4:35 pm
@ john
I just wouldn’t use any option to override the name in an email, but I think it has merit. Should have a switch in Prefs if enough people like it.
“Oh, and if you friend can’t find an email you forwarded to him, he’s probably not the sort of user that the program should be designed around.”
That would be for an old email I sent him months ago and he cannot immediately find on top of his inbox. He has no idea what kind of mail I’m talking about (maybe he never really read it). All he knows now is that it’s supposed to be very important and supposed to be from John Doe.
Ok, in that case I would probably just forward it again, that would be no big problem.
@ john’s PS
I don’t use iChat, because it sports those huge bubbles and does funny things with ICQ messages. But yes, I’d prefer it showed the nickname that my chatbuddy chose for himself/herself (and which might change upon his/her mood) than his formal name.
Bottom line: If somebody sends me a message, I want to see it as it was sent, and that would include all parts of the message.
September 25th, 2006 at 4:46 pm
@john: re: Your disappointment: I agree with you. I’m a recent mac switcher and this was one of the first things I noticed when switching to Mac Mail.
Also, not sure if you’ve noticed, but the same (or similar) issues prevents any sort of decent smart mailboxes based on address book information, because Mail.app isn’t smart enough to figure out that john@domain.com and John@domain.com are the same address.
I’m hoping this gets fixed in 10.5. Case-sensitivity in this case is definitely not a “feature” by any stretch of the imagination.
-brett
September 25th, 2006 at 9:48 pm
Just to add another viewpoint, I use Mail.app every day, and I use address book for my contact infomation. The whole thing works really well together, but this “bug”, so to speak, is definitely something that I would like to see resolved. My “from” column in Mail.app is rather unkempt and it shouldn’t be, especially since I have contact info filled in for all the senders.
September 25th, 2006 at 11:25 pm
@John…don’t know if this is helpful but you can turn off “Use Smart Addresses” in mail.apps preferences. In that case the email address is always shown in lieu of just the name.
I guess mail.app’s behavior doesn’t bother me being a former Outlook user. Outlook’s “name only” tendencies drove me to distraction for people with multiple email addresses.
September 25th, 2006 at 11:56 pm
This may be related to another bug in email addressing I’ve noted for a long time. Several ISPs use a webmail hosting client which, in addition to not supplying a user name, enclose the email address in angle brackets, e.g.:
From:
Mail displays this in the From column of the mailbox list view as:
If I reply to the message, this is how Mail addresses it (the brackets indicate the editable To address field in the compose form:
To: [ username@isp.com> ]
If I right-click on the ‘smart’ address rectangle and select “Edit Address” from the pop-up options this is how it renders it in plain text:
“dbsebastian@cox.net>
This is a well-formed address, of course, and the email will get through addressed that way, but it is butt-ugly.
Mail needs to display email addresses which don’t have a user name, even though they are clothed in angle brackets, as just the email address, and preferably without the angle brackets.
From: username@isp.com
To: username@isp.com
IMHO.
September 26th, 2006 at 12:03 am
Blast. The angle brackets in the immediately previous post were treated as html tags by the blog comment processing, so it completely munged all my examples of what’s going wrong here. Here it is again, and this time I will use a curly brace { or } to indicate the angle brackets.
This may be related to another bug in email addressing I’ve noted for a long time. Several ISPs use a webmail hosting client which, in addition to not supplying a user name, enclose the email address in angle brackets, e.g.:
From: {username@isp.com}
Mail displays this in the From column of the mailbox list view as:
{username@isp.com} {username@isp.com}
If I reply to the message, this is how Mail addresses it (the brackets indicate the editable To address field in the compose form):
To: [ username@isp.com} {username@isp.com {username@isp.com} ]
If I right-click on the ’smart’ address rectangle and select “Edit Address†from the pop-up options this is how it renders it in plain text:
“username@isp.com} {username@isp.com” {username@isp.com}
This is a well-formed address, of course, and the email will get through addressed that way, but it is butt-ugly.
Mail needs to display email addresses which don’t have a user name, even though they are clothed in angle brackets, as just the email address, and preferably without the angle brackets, e.g.:
From: username@isp.com
To: username@isp.com
IMHO.
February 27th, 2007 at 2:25 am
can this be fixed with an applescript?
April 16th, 2007 at 11:42 am
Come on… I can’t believe there isn’t a fix for this! I’ve searched Google for several hours now and haven’t even found many instances of this issue. (very hard to search for with so many generic keywords “mail+from+inbox+name+address apple”) – I only found this thread after typing “smart addresses”+inbox and this was the only one!
Surely there’s some sort of hack to fix it… there always is. :-(
I’m in a fixing spree at the moment – sorting out EVERYTHING that slows me down.
August 18th, 2007 at 12:34 pm
I wholeheartedly agree that being able to force Address Book names to override whatever the original sender may or may not have used is a Very Good Thing. The “potluck” appearance of my “To” list — some addresses just the person’s name, some the name plus address, and many different capitalization and abbreviation styles — is UGLY! If I know for a fact that is a coworker named John Smith, but John Smith once sent me email calling himself “The Toilet Man” — do I really want to be FORCED to see “The Toilet Man” in my outgoing business mail??? Sigh.
November 23rd, 2007 at 7:08 pm
The angular brackets eye sore really annoyed me so I came up with a quick and dirty work around. The attached python script will scan all your mailboxes and will strip the angular brackets from “From:” addresses missing the sender name. In addition it will try to add the sender name from the Address book to emails that lack names. The only downside is that this is a batch offline script. You need to manually run it from a terminal window in order to fix the addresses. The way this script works is by rewriting the “From:” line in the the message (.emlx) files. After running the script you need to re-index the mailboxes either by using the Rebuild menu command for each affected mailbox or by removing the “Envelope Index” file (mail.app will automatically re-index).
To use:
1. save the following lines to a file called add-name-to-address.py.
2. Start a terminal session
3. Set the execute bit of the file (chmod +x add-name-to-address.py)
4. cd ~/Library/Mail
5. Run: add-name-to-address.py
Note: Python is very sensitive to indentation, any changes in the indentation will break the script.
#! /usr/bin/python
###############################################################################
#
# This script removes angular brackets from stand-alone email addresses and
# tries to add names to emails that do not have the sender name in
# the from field. This script builds email -> name lookup table using the
# address book. It then parses the messages in the mailboxes searching for
# “From:” fields without sender names and uses the senders email address to
# lookup for the name. If the name is found the email address is substituted
# with name followed by the email address and the .emlx file is re-written.
# (e.g. From: jdoes@xyz.com -> From John Doe # )
#
# Usage:
# – cd ~/Library/Mail
# – add-name-to-address.py
# – Do one of:
# – Run build Messages->Rebuild in each mailbox.
# – Or
# – Quit Mail.
# – mv “Envelope Index” “Envelope Index.sav” (or just delete it)
# – Restart Mail.app. Mail.app will prompt you and will import your
# email and rebuild the index.
#
# – All the updated files will be marked as unread. Mark all files as
# read.
#
# Notes:
# – This script runs on Leopard and possibly on Tiger (never tested)
#
# – Mail.app mailboxes are stored in ~/Library/mail/Mailboxes
#
# – This script uses contacts to lookup the address book. Contacts may be
# downloaded from: http://gnufoo.org/contacts/
#
################################################################################
import time
import os
contacts = “/usr/bin/contacts”
contacts_args = “-HSf \”%n\t%he\t%we\t%oe\”"
lookup_tbl = {}
################################################################################
#
# BUILD_LOOKUP_TABLE Build email -> name lookup table from address book
#
################################################################################
def build_lookup_table():
f = os.popen(“%s %s” % (contacts, contacts_args), ‘r’)
line = f.readline()
while line:
tokens = line.split(“\t”)
for email in tokens[1:4] :
email = email.strip()
if email != “”:
lookup_tbl[email.lower()] = tokens[0].strip()
line = f.readline()
f.close()
################################################################################
#
# FIX_EMAIL_ADDRESS Try to prepend name to email address. If name was not
# found return the original email address.
#
################################################################################
def fix_email_address(email):
if lookup_tbl.has_key(email.lower()):
return “\”%s\” ” % (lookup_tbl[email.lower()], email)
else:
return email
################################################################################
#
# FIX_MESSAGE Fix message, save the original message with .”orig” extension
# and write the fixed message using the original file name
#
################################################################################
def fix_message(file, lines):
print “Fixing ” + file
f = open(file + “.new”, “w”)
f.writelines(lines)
f.close()
os.rename(file, file + “.orig”)
os.rename(file + “.new”, file)
################################################################################
#
# PROCESS_MESSAGE Process a single message file
#
################################################################################
def process_message(file):
f = open(file, “r”)
in_lines = f.readlines()
f.close()
out_lines = []
fixed_addr = “”
addr = “”
for line in in_lines :
if line[:5] == “From:”:
tokens = line.split()
if len(tokens) == 2:
addr = tokens[1]
if addr[0] == ”:
fixed_addr = addr[1:-1]
else:
fixed_addr = addr
fixed_addr = fix_email_address(fixed_addr)
line = “From: ” + fixed_addr + “\n”
out_lines.append(line)
if fixed_addr != addr:
fix_message(file, out_lines)
################################################################################
#
# traverse Recursively traverse a directory tree and process all the
# mailboxes in the tree
#
################################################################################
def traverse(tree):
entries = os.listdir(tree)
for name in entries:
path = os.path.join(tree, name)
if os.path.isdir(path):
traverse(path)
# Note: We skip files that have just been changed to avoid collisions
# with mail.app
elif os.path.isfile(path) and \
name[-5:] == “.emlx” and \
os.path.getmtime(path)
November 1st, 2008 at 6:53 am
This bugs the heck out of me. I get e-mails from 3 different sources for one guy and all the names are displayed different, even though I have the e-mails added to his address book entry.
I wish I could write a applescript to modify the incoming message headers, better yet.. I wish apple would fix this.
July 15th, 2009 at 12:46 am
I have a colleague who just about messed up my Mail’s email entries. I am really … really looking forward for a “fix” for this issue to come. Or an apple-script too would be good.