On Jan 11, 2016, at 8:20 AM, Christopher Stone wrote:
On Jan 10, 2016, at 15:55, S. J. Cunningham <
email@hidden> wrote:
Apparently storing it in the outbox counts as success?!
______________________________________________________________________
Hey Steve,
Bleep!
Is there any way to tell if it was actually sent? I guess I could check the outbox
I don't see any other obvious way.
tell application "Mail"
if messages of outbox ≠ {}
# Do something...
end if
end tell
but that seems pretty lame.
Yes.
I modified your suggestion to allow for more than one message in the outbox and to allow time to send:
on reallySend(theMessage)
set aDecentAmountOfTime to 5 -- seconds
set tryTryAgain to 3
tell application "Mail"
set previousCount to count of messages of outbox
if not (send theMessage) then
error "Send Failed" number 101
end if
repeat with ifAtFirstYouDontSucceed from 1 to tryTryAgain
if (count of messages of outbox) > previousCount then
log "Waiting " & ifAtFirstYouDontSucceed
delay aDecentAmountOfTime
else
log "He's gone, Jim"
return
end if
end repeat
end tell
error "Message is stuck in the Outbox" number 102
end reallySend
I'd like to get the actual message ID but it is too ugly to even contemplate.