3 Replies Latest reply: Oct 24, 2008 8:24 AM by BenChase
BenChase Level 1 Level 1 (10 points)
I have part of my script attaching a pdf to a mail message and sending it out. Mail "unexpectedly quits" almost after every message. Is it something wrong with my script?

heres the part where the message gets made and sent:

set subj to "Proof for " & AdName
set EmailFile to POSIX path of fileName --Mail likes UNIX file paths instead of AppleScript (/ instead of : path delimiters)
tell application "Mail"
set outMessage to make new outgoing message with properties {visible:true, subject:subj, content:"" & return & return}
tell outMessage
make new to recipient at end of to recipients with properties {address:(Email)}
tell content to make new attachment at after last paragraph with properties {file name:EmailFile}
end tell
send outMessage
end tell
  • Budgie Level 4 Level 4 (1,120 points)
    Hi BenChase

    try replacing this line::

    set EmailFile to POSIX path of fileName

    with this::

    set EmailFile to POSIX path of fileName as alias


    and this line::

    tell content to make new attachment at after last paragraph with properties {file name:EmailFile}

    with this::

    tell content to make new attachment with properties {file name:EmailFile as alias} at after the last paragraph


    that may help

    Budgie
  • BenChase Level 1 Level 1 (10 points)
    The path to the file is on a server volume and when I set it as an alias it can no longer find the file. Am I missing something?
  • BenChase Level 1 Level 1 (10 points)
    The path to the file is on a server volume and now with it set as alias the script errors and says it cant find the file.