AddThis Social Bookmark Button


Listen Print

The sendTheEmail handler

on sendTheEmail()
        set theAttachment to (¬
                choose file with prompt "Select the file attachment:")
        
        tell application "Outlook Express"
                activate
                try
                        set the emailDestination to ¬
                                "bwperry@mac.com"
                        
                        set emailSubject to ¬
                                "Check out my triathlon finish!"
                        
                        set emailContent to "And you " & ¬
                                "didn't believe that I could swim, bike, and run" & ¬
                                " all in the same morning!"
                        
                        set emailAccount to POP account ¬
                                "mac.com"
                        
                        set draftWindow to make new ¬
                                draft window with properties ¬
                                {subject:emailSubject, content:emailContent, ¬
                                to recipients:emailDestination, account:emailAccount} 
                                        
                        make attachment at draftWindow ¬
                                with data {file:theAttachment, encoding:binhex}
                        
                        send draftWindow
                on error error_message
                        
                        display dialog error_message
                end try
        end tell
        
end sendTheEmail

Return to the article.