Mail is OS X 10.11 Does not send attachments via AppleScript

Originator:peter
Number:rdar://23291106 Date Originated:28-Oct-2015 02:52 PM
Status:Open Resolved:
Product:Mail Product Version:9.1 (3096.5) OS X 10.11.1 (15B42)
Classification:UI/Usability Reproducible:Always
 
Summary:
If you create an outgoing email with an attachment, Mail takes some time to actually attach the attachment.  So if you try to create it via AppleScript and then immediately send it, the message is sent before the attachment is attached.

tell application "Mail"
	
	set theSubject to "Subject" -- the subject
	set theContent to "Content" -- the content
	set theAddress to "whoever@apple.com" -- the receiver 
	set theSignatureName to "Standard" -- the signature name
	set theAttachmentFile to "Zany:Users:username:file" -- the attachment path
	set msg to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
	
	tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
	tell msg to make new attachment with properties {file name:theAttachmentFile as alias}
	
	set message signature of msg to signature theSignatureName
	
	--	send msg
end tell

Steps to Reproduce:
Run the AppleScript, note how the attachment shows up after a few seconds.  Close and delete the message, then uncomment the send msg line and run it again - the message is sent without the attachment.

Expected Results:
The message should be sent with the attachment as requested.

Actual Results:
The message is sent without the attachment.

Version:
Version 9.1 (3096.5) OS X 10.11.1 (15B42)

Notes:


Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!