Emailing attachments doesn't work in Sierra 10.12.4


#1

I’ve been using Mail w Attachments (which from memory was written by Dave) successfully for years, most recently in Yosemite, but it has stopped working in Sierra. ( I’m using Sierra only because I had to get a new MacBook Pro.) The emails are sent, but without the attachments. There is no error message.

I’m using OSX10.12.4 but I don’t think it worked in 10.12.2 either. Has anybody been able to send attachments successfully in Sierra?

David Duncan


#2

I haven’t recently been using that module myself, but I have had one other report of this. I did some on-line research, and it appears that recent versions of Mail are responding to the command to send the email, before the attachments have been added. The solution appears to be to insert a delay before sending.

I’ve uploaded a revised version to my Dropbox account. It checks to see if there are any attachments, and if there are, it inserts a one second delay into the AppleScript before sending. The Dropbox link is

https://www.dropbox.com/s/vpy65vfz6ql3lb1/Mail%20w%20Attachments.zip?dl=0


Email Attachment
#3

Wow, Dave, that worked like a charm!

I had found the same comments and had inserted a delay but obviously in the wrong place. (I’ve studied your AppleScript and I can’t find the delay you inserted but I’m sure it’s in the right place.)

Many thanks for fixing this.

David Duncan


#4

It’s in the ?( function near the end of this section.

tell newMessage

”+eTo+¶+eCC+¶+eBCC+“
tell content
    repeat with thisAttachment in theseFiles
    make new attachment with properties {file name:thisAttachment}
    end repeat
    end tell
end tell
”+?(eAttachments <> "","delay 1"+¶,"")+
“send newMessage
end tell