Maybe someone here can assist me with this.
I have an older AppleScript called zip-to-mail, which I modified to work with my gmail account, etc. It's a relatively simple script that locates a file in the Finder, zips the file, creates a new email, adds the file name and current date as the subject line, attaches the zipped file, mails it to my gmail account, and deletes the zipped file. I have used it for years with several versions of MacOS and it's very convenient. At some point in 2017, unbeknownst to me, the script stopped working. It appeared to be working but the attachments were missing. I happened to look for an archived file from my gmail account the other day and there was no attachment. There was no attachment for the previous message either or the one before that or before that, all the way back to mid-2017. I never saw an error message and the script always ran. If I recall correctly, it was at that point in 2017 that I upgrade my iMac from Mavericks to Sierra. I am now running Mojave, which throws up a couple of security messages during execution of the script (to which I can click OK). However, my point is that the script is not attaching the zip file as it should and I don't know why. Anyone? The original script, called zip-to-mail, was in fairly common use for several years I believe; simply modified the existing script to suit my personal situation. I can post the code here of course. Recompiling the script didn't help.
The problem isn't the date. The date is correctly inserted into the outgoing mail.
Did you fix it? Because otherwise I’m confused by your 13 Apr post, where you specifically called out two problems, one of which was the date.
*shrug*
Anyway, with regards your attachment issue, try the following:
set fileToAttach to POSIX file "/Users/quinn/Desktop/tmp.txt"
tell application "Mail"
make new outgoing message
set m to the result
tell content of m
make new attachment with properties {file name:fileToAttach} at after the last paragraph
end tell
end tell
On my machine this creates a message and adds the file as an attachment [1].
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
[1] It also triggers a TCC alert to grant Script Editor access to the desktop and you have to agree to that.