Yosemite Mail app: Can’t send Gmail messages

Recently, I decided to download all my mail into Mail app. I wanted to be able to receive and send using my existing Gmail account, but it didn’t work for me. I kept getting a prompt that Gmail was offline, when I knew otherwise. (Sending via mail.google.com web app worked, for example.)

After some digging, I found the solution in an Apple discussion forum. In case the answer ever gets buried (I hope not), it is related to truncation of the SMTP username; e.g. “kzhiwei@gmail.com” is shortened to “kzhiwei”. This does not work. To change, load up Mail, then click into Preferences > Accounts > Outgoing Mail Server (SMTP) > Edit SMTP Server List. Switch to the Advanced tab, then change the “User Name” field. For your reference, mine looks like:

Screenshot 2015-03-09 14.02.46

As usual, your mileage may vary. (And you’ll need to enable IMAP for Gmail, too.)