I am writing a script that will create standard emails. I would like the email to have an attachment. I cannot get the script to attach the file automatically. Any help with what I am doing wrong would be appreciated.
Here is the part of the script I am having trouble with:
if theSelection is equal to {"Building Roofing Solutions"} then
tell application "Mail"
activate
set this_message to make new outgoing message with properties {visible:true, subject:"Test Subject", content:"Test Content"}
tell this_message
make new to recipient at end of to recipients with properties {address:this_email as text}
make new attachment with properties {file name:"Macintosh HD:Sampe.pdf"} at after the last paragraph
end tell
end tell
end if
the syntax for make new attachment is a little different
if theSelection is equal to {"Building Roofing Solutions"} then
tell application "Mail"
activate
set this_message to make new outgoing message with properties {visible:true, subject:"Test Subject", content:"Test Content"}
tell this_message
make new to recipient at end of to recipients with properties {address:this_email as text}
tell content to make new attachment with properties {file name:"Macintosh HD:Sampe.pdf" as alias} at after the last paragraph
end tell
end tell
end if
I change the code and I am no longer getting an error message, but the file is still not attaching.
The email address, subject and contect show up but no attachment. I verified that the file path is correct. I have a file called Sampe.pdf on the root level of my drive (named Macintosh HD)
I even pulled the code out of the rest of the script and still no joy.