You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

block multiple senders at the same time

Most (90%?) of the emails I get are solicitations from companies/senders. No surprise there. I know how to block them individually, but Apple should create way to highlight multiple emails and block them all it once. Is this possible already? I don't think so, but it would be a wonderful improvement and product feature for on my computers and iPhones!


Posted on Oct 5, 2020 6:23 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 5, 2020 11:35 AM

Thanks for this. The Apple script scares me to death to try to take on!

I've become wary of unsubscribing, as clicking on the link could just as easily be launching some malware (or at least that's possible, isn't it?). As we both know, Apple Mail allows me to right-click on the sender to Block Contact. What would be perfect is a way to ctrl-click several emails and do a batch block. I think that would benefit us all, given the enormous number of unsolicited emails we all get. Thanks again, Martin

4 replies
Question marked as Top-ranking reply

Oct 5, 2020 11:35 AM in response to MartinR

Thanks for this. The Apple script scares me to death to try to take on!

I've become wary of unsubscribing, as clicking on the link could just as easily be launching some malware (or at least that's possible, isn't it?). As we both know, Apple Mail allows me to right-click on the sender to Block Contact. What would be perfect is a way to ctrl-click several emails and do a batch block. I think that would benefit us all, given the enormous number of unsolicited emails we all get. Thanks again, Martin

Oct 5, 2020 6:42 AM in response to RJMK

I do not believe there is any way to "highlight multiple emails and block them all it once."


Depending on your email provider & the email application you are using, it may be possible to block domains rather than individual email addresses, but you would have to block the domains one by one (and it presupposes you are getting mail from multiple addresses within a single domain).


If the solicitations are from legitimate companies you should start by unsubscribing to their emails. There should be a link in every email enabling you to do this.

Oct 5, 2020 6:57 AM in response to RJMK

Sometimes, when the same email originator uses the same mail server to send emails appearing to be from different accounts and domains, you can spot these by reviewing the Return-Path mail header. This contains the originating mail server whose domain may be entirely different from what you see in the From header content.


Consequently, I have several unwanted emails that appear to be originating from multiple sources when reviewing the From header content, but yet use the same Return-Path server. Thus, I am able to create a single, or very few Mail criteria that using the Any selector, can move multiple emails to Junk for one rule.


I wrote a short AppleScript that displays the From and Return-Path header fields for a single email message selection. Done individually for a few selected messages, one may detect a pattern in the Return-Path address to construct more refined rules.


-- return-path.applescript
-- Select a given message item in Apple Mail, and then run this script. It will produce a dialog
-- showing the sender's From and Return-Path addresses. Copy the entire Return-Path
-- string into the right-window of an Apple Mail rule.
-- This script *does not* alter, or remove individual email messages.
-- VikingOSX, 2019-10-23, Apple Support Communities, No warranties of any kind

use framework "Foundation"
use AppleScript version "2.4" -- Yosemite or later
use scripting additions

property NSString : a reference to current application's NSString
property NSRegularExpression : a reference to current application's NSRegularExpression
property NSRegularExpressionCaseInsensitive : a reference to current application's NSRegularExpressionCaseInsensitive

tell application "Mail"
	if not it is running then activate
	
	if not (get selection) is {} then
		set theMsg to item 1 of (get selection)
	else
		return
	end if
	
	tell theMsg
		set theSender to its sender
		set theHDR to its all headers
	end tell
end tell
set rtnpath to my return_address(theHDR) as text
set fmsg to "Sender Address:" & return & theSender & return & return & ¬
	"Return-Path:" & return & rtnpath

display dialog fmsg with title "Current Mail Item Addresses"
return

on return_address(atxt)
	set hstr to NSString's alloc()'s initWithString:atxt
	set pattern to "(?<=Return-Path:|Return-path:)\\s+(<.*?>).*"
	set regex to NSRegularExpression's regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive |error|:0
	set hrange to current application's NSMakeRange(0, hstr's |length|())
	set matches to (regex's firstMatchInString:hstr options:0 range:hrange)
	
	if matches = "" then return "Not Found"
	
	set matchrange to matches's rangeAtIndex:1
	return (hstr's substringWithRange:matchrange) as text
end return_address


Oct 5, 2020 7:56 PM in response to RJMK

RJMK wrote:
I've become wary of unsubscribing, as clicking on the link could just as easily be launching some malware (or at least that's possible, isn't it?).


Well, I did say, if the emails are from legitimate companies you should start unsubscribing.


If you're getting junk mail, or you can't tell if the emails are legitimate, that's another matter.

block multiple senders at the same time

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.