41

I would like to set it up so that Gmail labels incoming mail based on which business email of mine the emails are sent to. I have two business emails that come to my Gmail account.

For instance, if someone emails me at [email protected], I would like the email to be automatically labeled first business. If someone emails me at my other email address (which also is forwarded to Gmail), [email protected], I would like that email to be automatically labeled second business.

Is there any way to do this?

0

8 Answers 8

36

Of course there is; that's just basic filters.

Here's one way to make such a filter:

  1. In the Gmail search box, search for messages sent to your email address, like this: to:[email protected]
  2. Assuming you got some results, click the small arrow on the right side of the search box. This will bring up the advanced search menu.
  3. Click "Create filter with this search"
  4. Choose what you want to happen to the message when it comes in. One of the options is "apply a label" but there are others you can do. It all depends on your needs.
8

Sure there is!

  1. When you're reading a mail you want to auto label
  2. hit the [More ▼] button
  3. and choose "Filter messages like these"

Set your criteria and click the "Create filter with this search »" link to choose your Label

3
  1. Open mail in Gmail to or from address: [email protected]
  2. Click More
  3. Chose Filter messages like this from dropdown list
  4. In the to textfield enter your email address: [email protected]
  5. In the from textfield enter your email address again: [email protected] (Note: I did this separately)
  6. Click Create filter with this search
  7. Check Apply the label: then chose New label from dropdown
  8. In upper textfield enter your domainname (or whatever you want the label to be called) and click create
  9. Check also Always mark it as important
2

Utilize filters for this. Go to:

Settings > Filters

You can filter on the to: field. Example:

Then you would create a second filter to auto-label the second business email.

2

If you are having gmail retrieve the email via pop3, you can have the emails automaticaly labeled and/or archived

  1. Click Gear button /Settings
  2. Accounts and Import
  3. Find the "Check mail from other accounts (using POP3" section
  4. Click on the "edit info" link.
  5. Specify an existing label or create a new label
  6. You can also "Archive incoming messages (Skip the Inbox)"
  7. Save Changes
1

1.Go to the search bar at the top of your email and click on the dropdown list

2.Type in your search requests

3.Click on Create filter with this search >>

4.Click on your requirements for when the messages arrive

  • press whichever ones you want

    • I suggest "Skip inbox", then it won't appear in your inbox

5.Click Choose label on apply label, and create new label

6.Name label based on what the topic of the messages are

7.Click create filter

That is it, but a word of caution: this filter will only apply to new messages. If there are old ones you want to put in this filter, select them, and move them to the label. To do this, just select all the messages you want to move. Then press the "labels" option below the search bar (it's the one that looks like a tag), and check the label you want to put it in. And you're done!

0

In creating your filters, instead of putting [email protected] in the from box, put

from:[email protected] OR to:[email protected] 

in the has text box.

In doing this your replies to him are also auto tagged.

0

We can use Google App Script to get an automated flow for this.

First, create a rule that will add a label to all your incoming emails. For, e.g, let this be—Unprocessed.

Then, head to App Script, and create a new project. Give it necessary permissions. Then, in the code add the following -

function myFunction() {
  var allEmailThreadsSearch = GmailApp.search('label:Unprocessed')
  allEmailThreadsSearch.forEach(m => {
      m.getMessages().forEach(msg => 
       {
         sender = msg.getFrom();
         domain = sender.split("@")[1].split('.')
         label = GmailApp.createLabel(domain[domain.length-2])
         label.addToThread(msg.getThread())
         var unprocessed = GmailApp.getUserLabelByName('Unprocessed')
         msg.getThread().removeLabel(unprocessed)
       })});
}

When this code runs,

  1. It will filter out all the emails that are present with label Unprocessed and store in allEmailThreadSeach.
  2. For each one of them, it will get the sender email and find the domain name from that email.
  3. Create a new Label with that domain name and add this label to the current thread.
  4. Remove the Unprocessed label.

Lastly, create a trigger which will execute this script every hour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.