Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatically sending an attachment using Apple Mail.



My app generates a file, with a name that is different each time.  I'm want to be able to send this file as an attachment to an email, using Apple Mail.

--I can create the name of the file using:
set theAttachment1 to rtfName & ".rtfd"

--The file is always generated on the desktop, so I thought I would be able to create a full reference to it by :
set theAttachment to "~/Desktop/" & theAttachment1

--However, this doesn't work, whilst using "set theAttachment to choose file" works, I don't want to have any interaction with the script.

--All the other properties (theAccount, theSubject, theData, theAddress) work fine.

tell application "Mail"
            activate
            set newMessage to make new outgoing message with properties {account:theAccount, subject:theSubject, content:theData}
            tell newMessage
                make new to recipient at end of to recipients with properties {address:theAddress}
                set visible to false
                tell content
                    make new attachment with properties {file name:theAttachment} at after the last paragraph
                end tell
            end tell
           send newMessage
        end tell


Can anyone help?

Regards
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.