MySQL: Count email addresses by domain

If you have a table (e.g. my_table) with an email address column (email), and want to count how many addresses are in the table for each domain, you can use the following query:

    SUBSTRING_INDEX(email, '@', -1) AS domain
    FROM my_table
    GROUP BY domain ORDER BY count DESC

GMail div class=”im” results in purple text.


When testing HTML emails you might notice that GMail shows HTML text in purple, overriding the CSS styles you defined in the newsletter HTML.

This is because you probably sent the same (slightly altered) email to yourself more than once, resulting in a thread of several emails. GMail, being clever, assumes that because a text passage appears in all emails, it is being quoted in the following emails. It wraps the text in a div class="im" which displays the text in purple.


Delete all previous emails, and the text in the email should be displayed as you intended.