Click the Mail menu in the top left hand corner, and click Preferences.
Click the accounts tab at the top, and click the Gmail account on the left.
Click the list beside Outgoing Mail Server (SMTP), and click Edit Server List.
Select any Gmail outgoing servers, and press the minus to the bottom left of the list to remove them.
When there are no more Gmail SMTP servers left, click the + button.
Below that in Account Information leave Description blank and type smtp.gmail.com for Server name. Leave TLS set to None.
Then click Advanced, make sure it is port 25, that Authentication says Password, and insecure authentication is un-ticked.
Type your username and password ***** the Gmail account, and click OK.
Verify that the SMPT server selected in the Accounts page is the Gmail one you just added.
Close preferences and click Save.
Now try to send the test email to your .Mac account.