Auto select mail and put them in label in gmail

You can use Gmail's filters and labels to automatically select and label emails. Here's how:

Method 1: Using Gmail's Filter

  1. Log in to your Gmail account.
  2. Click on the gear icon () and select "See all settings."
  3. Go to the "Filters and Blocked Addresses" tab.
  4. Click on "Create a new filter."
  5. In the "From" field, enter the email address or domain you want to filter (e.g., @example.com).
  6. Click on "Create filter."
  7. In the "Apply the label" dropdown menu, select the label you want to apply to the selected emails (e.g., "Important").
  8. Click on "Create."

Method 2: Using Gmail's Search Operator

  1. Log in to your Gmail account.
  2. Use the search bar to search for the emails you want to label. You can use search operators like from:example.com or subject:important.
  3. Click on the "Search" button.
  4. In the search results, select all the emails by checking the box at the top left corner of the page.
  5. Click on the "More" menu and select "Apply label."
  6. Select the label you want to apply to the selected emails (e.g., "Important").

Method 3: Using Gmail's Script

  1. Log in to your Gmail account.
  2. Click on the gear icon () and select "See all settings."
  3. Go to the "Labs" tab.
  4. Enable the "Canned responses (templates)" feature.
  5. Click on the "Save Changes" button.
  6. Go back to the "Settings" page and click on the "Filters and Blocked Addresses" tab.
  7. Click on "Create a new filter."
  8. In the "From" field, enter the email address or domain you want to filter (e.g., @example.com).
  9. Click on "Create filter."
  10. In the "Apply the label" dropdown menu, select the label you want to apply to the selected emails (e.g., "Important").
  11. Click on "Create."
  12. Go back to the "Labs" tab and click on the "Canned responses (templates)" feature.
  13. Click on the "New template" button.
  14. In the "Template name" field, enter a name for your template (e.g., "Label Important Emails").
  15. In the "Template" field, enter the following script:
    function labelImportantEmails() {
    var threads = ThreadList.getThreads();
    for (var i = 0; i < threads.length; i++) {
     var thread = threads[i];
     var messages = thread.getMessages();
     for (var j = 0; j < messages.length; j++) {
       var message = messages[j];
       if (message.getFrom().indexOf('@example.com')!== -1) {
         message.applyLabel('Important');
       }
     }
    }
    }
  16. Click on the "Save" button.
  17. Go back to your Gmail inbox and click on the "More" menu.
  18. Select "Run canned response" and choose the template you created.

Note: The script method requires some programming knowledge and may not work as expected if you're not familiar with JavaScript.