LC, Mac Mail & Rules

Paul Hibbert paul at livecode.org
Wed Feb 24 13:38:40 EST 2021


I know this is moving away from LC, but you can use a simple AppleScript to to do this, then trigger the AppleScript from Mail rules, or run as a standalone app, or you could trigger the AppleScript from LC if that’s what you need.

I’m no AppleScript expert, I just did a bit of searching and found a script that could be easily modified, anyway, this is the script I tested and it seems to do what you asked. It could probably be improved, if anyone understands AS better please step in.



set toAddress to "myemailaddress at mail.com"
set toName to "My Name"
set toSubject to "Something Cool"

tell application "Mail"
	repeat with _acct in imap accounts
		--Look For Messages in the INBOX with the subject set in toSubject 
		set _acct_name to name of _acct
		set _inbox to _acct's mailbox "INBOX"
		set _msgs_to_capture to (a reference to ¬
			(every message of _inbox ¬
				whose subject is toSubject))
		
		repeat with _msg in _msgs_to_capture
			set _fwdmsg to forward _msg with opening window
			
			tell _fwdmsg
				make new to recipient at end of ¬
					to recipients with properties {name:toName, address:toAddress}
			end tell
			
			activate
			
			send _fwdmsg
		end repeat
	end repeat
end tell



To compile this code, open Utilities > Script Editor, create a new script and paste the code in, make the changes you need to lines 1, 2 and 3 and save the script as an application in the User > Library > Application Scripts > com.apple.mail folder, then it will be available in the Apple Mail Rules.

Paul

> On 24Feb, 2021, at 8:29 AM, Rick Harrison via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi Matthias,
> 
> Ok, so Mojave is good and macOS Mail in Catalina is the problem.
> 
> I don’t know if we can come up with an LC solution work around
> for this problem, or if I need to be looking at some other email
> client software.  Is anyone using Thunderbird or another
> program that has Rules or Filter auto-respond capability
> that might work?
> 
> Your thoughts and suggestions?
> 
> Thanks,
> 
> Rick
> 
>> On Feb 24, 2021, at 11:23 AM, matthias rebbe via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi Rick,
>> 
>> i mixed the version numbers. I tested with 15.3 which is Catalina. There it shows also the behaviour.
>> In Mojave the subjects is not changed and keeps the original value.
>> 
>> Please excuse the confusion.
>> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list