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
- Log in to your Gmail account.
- Click on the gear icon () and select "See all settings."
- Go to the "Filters and Blocked Addresses" tab.
- Click on "Create a new filter."
- In the "From" field, enter the email address or domain you want to filter (e.g.,
@example.com
). - Click on "Create filter."
- In the "Apply the label" dropdown menu, select the label you want to apply to the selected emails (e.g., "Important").
- Click on "Create."
Method 2: Using Gmail's Search Operator
- Log in to your Gmail account.
- Use the search bar to search for the emails you want to label. You can use search operators like
from:example.com
orsubject:important
. - Click on the "Search" button.
- In the search results, select all the emails by checking the box at the top left corner of the page.
- Click on the "More" menu and select "Apply label."
- Select the label you want to apply to the selected emails (e.g., "Important").
Method 3: Using Gmail's Script
- Log in to your Gmail account.
- Click on the gear icon () and select "See all settings."
- Go to the "Labs" tab.
- Enable the "Canned responses (templates)" feature.
- Click on the "Save Changes" button.
- Go back to the "Settings" page and click on the "Filters and Blocked Addresses" tab.
- Click on "Create a new filter."
- In the "From" field, enter the email address or domain you want to filter (e.g.,
@example.com
). - Click on "Create filter."
- In the "Apply the label" dropdown menu, select the label you want to apply to the selected emails (e.g., "Important").
- Click on "Create."
- Go back to the "Labs" tab and click on the "Canned responses (templates)" feature.
- Click on the "New template" button.
- In the "Template name" field, enter a name for your template (e.g., "Label Important Emails").
- 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'); } } } }
- Click on the "Save" button.
- Go back to your Gmail inbox and click on the "More" menu.
- 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.