Send Attachments No Longer Working After El Captain Update

Hi guys,

I had the script below working from inside of an Excel macro but after the update to El Captain the script simply stopped attaching files. The script still runs and sends the email but it comes out blank without anything attached.

I double checked to make sure the path is correct and the files are there but it still won’t attach them. Does any of you have any idea as to why this happening?

Mac Script:
tell application “Mail”
set theMessage to make new outgoing message with properties {subject:“CrossFit Boxes Scrape Charts 11/17/2015”, content:“”, visible:true}
set Attachment1 to “Macintosh HD:Users:user:Desktop:Chart 1.png”
set Attachment2 to “Macintosh HD:Users:user:Desktop:Chart 2.png”
set Attachment3 to “Macintosh HD:Users:user:Desktop:Chart 3.png”
set Attachment4 to “Macintosh HD:Users:user:Desktop:Chart 4.png”
tell theMessage
make new attachment with properties {file name:Attachment1 as alias}
make new attachment with properties {file name:Attachment2 as alias}
make new attachment with properties {file name:Attachment3 as alias}
make new attachment with properties {file name:Attachment4 as alias}
end tell
tell theMessage
make new to recipient with properties {name:“ricardo@ebbex.com”, address:"ricardo@ebbex.com"}
send
end tell
end tell

Thanks in advance for your help!

You may try :

tell theMessage to tell content
make new attachment with properties {file name:Attachment1 as alias}

Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) jeudi 19 novembre 2015 21:03:53

Thanks Yvan, just tried but still not attaching…

How about this:

tell b's content 
		make new attachment with properties {file name:pay_Path as alias} at after the last paragraph 
end tell

Sending the email but still not attaching :frowning:

After I upgraded to El Capitan, I had problems with the script below also not attaching the file. I use this to send an Excel SS to my accountant every 2 weeks for payroll. After some experimentation on the identified line, it now works.

set pay_Path to ((path to documents folder as Unicode text) & "Cathouse:Payroll:Paysheets:" & (date_String(current date)) & ".xls") --This creates the proper file to save the already open Excel spreadsheet
tell application "Microsoft Excel"
	activate
	save active workbook in pay_Path 
	close active workbook
end tell

tell application "Mail"
	set b to make new outgoing message with properties {sender:"xxxx@yyy.com", subject:("Payroll for " & new_date)}
	set content of b to "Hello:

Here is the payroll ending today, " & (short date string of (current date)) & return & "Contact me if you have any questions." & return & return & "Craig A. Smith, DVM" & return & return
	tell b's content 
		make new attachment with properties {file name:file pay_Path} at after the last paragraph --HERE IS THE ATTACHMENT PORTION THAT HAS BEEN UPDATED TO WORK IN EL CAPITAN
	end tell
	tell b to make new to recipient with properties {address:"aaa@bbb.com"}
	send b
end tell
----------------------------------------------------------------
on date_String(j)
	set new_date to ((FixDay(j's day)) & (j's month) & (j's year)) as string
	return new_date
end date_String

--------------------------------------------------------------
to FixDay(q)
	if (q as real) < 10 then
		set q to ("0" & q) as string
	end if
	return q
end FixDay

Good luck,

I’ve found a workaround that should fix this for now ” add a delay before sending. So with the original, something like:


tell theMessage
        make new to recipient with properties {name:"test", address:"test@test.com"}
        delay 1
        send
end tell

Try adjusting the delay amount ” I saw users who were able to get this working with a delay .2, others who had to do multiple seconds (delay 5). Probably depends on other aspects of what’s happening, or maybe machine speed, dunno.

Annoying, but my script to fire a bunch of emails to my spam filter as attachments is working again, after just noticing it’s probably not been working correctly since 10.11…Just a bit slower. :slight_smile: