I have a Google Apps account with 1 primary domain and a secondary alias domain (let's say example.co.uk and example.com). When I send emails from the alias domain, the receiving person sees the sender as "email@example.com On Behalf Of firstname.lastname@example.org", which is a bit messy. How do I get rid of this?
To do this, you need to set up Gmail to send emails via an "external" mail server. However, since the alias domain is already registered with Google, you can in fact set this "external" server to their servers and have it work just fine!
- Gmail -> Settings -> Accounts -> Edit Info (on alias account) -> Next Step -> Send through example.com SMTP servers (recommended for professional domains)...
- SMTP Sever: smtp.gmail.com, Port 465
- Username: email@example.com (Note: not the alias domain login, but your main Gmail login)
- Password: (Password for the above account)
- Select Always use a secure connections (SSL) when sending mail.
If you don't have this other domain added as an alias and are just sending from an additional email address you'll have to send via the email servers of this other domain.
(Yes, I know I answered my own question, but it took me an age to figure this out, so I wanted to share it!)
You can use gmail's send-through feature. Under settings -> accounts and import, edit the email address in question, and when prompted, choose to "send email through example.com SMTP servers". After configuring the SMTP server settings, you should be good to go.
Here's my writeup on why the accepted answer both works and doesn't:
Basically, you need to set both the SPF and DKIM fields for "via" to go away. There's a bug that removes "via" if you have neither set, but that's just a bug, and you really should set both for deliverability anyway. That should allow you to properly remove the "on behalf of" display in Gmail.
What Stavros suggested vastly improves the reliable delivery of our emails to any outside domains and will cause it to not go to spam.
However to finally clinch it, I turned ON an important option of "Allow Per User External Gateways" in Gsuite Admin found under "https://admin.google.com/ac/apps/gmail/ enduseraccess"
What this does is under the Email that we add, after Clicking Next Step, instead of just refreshing it as a Saved option, it takes to a next screen of providing the SMTP server login details of the outbound domain and there you can again give the userid@aliasdomain name and password.
This finally ensured that the mails always go out as user@aliasdomain without the receiving outlook clients showing On Behalf of or Via.
I guess the steps Stavros advised are also needed at the DNS level but he may have assumed that this step is already turned on and despite giving SMTP details the On Behalf shows up.
So what is missing in your case could be the enabling of "Allow Per User External Gateways"