Monday, March 1, 2021

#1 2021-01-17 10:05:40 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 1645

Mail.app: Its Move command works as Duplicate command?

Hi, all.

I recently encountered strange behavior in Mail.app. My goal was to move all messages from the SENT-box to the INBOX, and count the transferred messages. At the same time, if I request messages from the SENT-box, it returns not only its messages, but those deleted from it too !!!

I found a way to work around this problem by applying the whose deleted status is false filter.

Other strange thing is this: moving (not deleted) messages works as duplicate command!!!

The question is, am I doing something wrong (with the move command), or Mail.app is so strangely programmed. Maybe someone knows more about the move command of this app.

My script so far:

Applescript:


set accountName to "Gmail" -- local name of my Google account
set sourceMailboxName to "[" & accountName & "]/Απεσταλμένα" -- local name of SENT box of my Google account
set destinationMailboxName to "INBOX" -- local name of INBOX box of my Google account

tell application "Mail" to tell account accountName
   -- get only not deleted messages of SENT mailbox
   tell mailbox sourceMailboxName to set snoozedMessages to messages whose deleted status is false
   repeat with theMessage in snoozedMessages
       set read status of theMessage to false
       move theMessage to mailbox destinationMailboxName
   end repeat
end tell

set messageCount to count of snoozedMessages
if not messageCount = 0 then display notification "" with title "Moved to Inbox" subtitle messageCount & " snoozed messages" as text sound name "Tink"

Last edited by KniazidisR (2021-01-18 05:21:52 am)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#2 2021-01-18 03:58:11 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4617

Re: Mail.app: Its Move command works as Duplicate command?

I can't test with your system.
Are you getting the same behavior if the source account isn't a Gmail one?
I ask because, here, I met some differences between Gmail, account and others.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 18 janvier 2021 10:57:43

Offline

 

#3 2021-01-18 04:59:43 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 1645

Re: Mail.app: Its Move command works as Duplicate command?

Yvan Koenig wrote:

Are you getting the same behavior if the source account isn't a Gmail one?
I ask because, here, I met some differences between Gmail, account and others.


I tested now move command within my iCloud account, and it works as expected (as move command). So the problem is only with Google accounts. I tested with this script:

Applescript:


set accountName to "iCloud" -- local name of my iCloud account
set sourceMailboxName to "Sent Messages" -- local name of SENT box of my iCloud account
set destinationMailboxName to "INBOX" -- local name of INBOX box of my iCloud account

tell application "Mail" to tell account accountName
   -- get only not deleted messages of SENT mailbox
   tell mailbox sourceMailboxName to set snoozedMessages to messages whose deleted status is false
   repeat with theMessage in snoozedMessages
       set read status of theMessage to false
       move theMessage to mailbox destinationMailboxName
   end repeat
end tell

set messageCount to count of snoozedMessages
if not messageCount = 0 then display notification "" with title "Moved to Inbox" subtitle messageCount & " snoozed messages" as text sound name "Tink"

Last edited by KniazidisR (2021-01-18 05:03:21 am)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#4 2021-01-18 10:20:51 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4617

Re: Mail.app: Its Move command works as Duplicate command?

It's what I feared.
When I receive an email thru Gmail, Mail store it in two locations:
Boite de réception > Gmail
Archives > Gmail (Tous les messages)

It may explain why you get the messages twice.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 18 janvier 2021 17:20:46

Offline

 

#5 2021-01-18 11:19:51 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 1645

Re: Mail.app: Its Move command works as Duplicate command?

Yvan Koenig wrote:

When I receive an email thru Gmail, Mail store it in two locations:
Boite de réception > Gmail
Archives > Gmail (Tous les messages)

It may explain why you get the messages twice.


OK, interesting info. Thanks for that. But other problem, with moving the messages from Gmail's Sent mailbox, remains. Maybe, the messages in this box is mirrored from Archives > Gmail mailbox, somewhat. I repeat, when I move some messages from Gmail's Sent mailbox using script, they copied instead of moving... When I move manually, Gmail's Sent mailbox lost those messages as expected.


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)