Thanks for your inputs!
After digging a bit deeper in the code i figured out how TIM handles the mailing. tim.sendQueuedMail() is part of the update callback function (fired from OnUpdate), so one mail from the queue is sent every tick.
TIM uses a custom throttle function to control update ticks for special purposes. I ended up using this function in tim.sendQueuedMail() with my desired delay and it works.
Here is the final code:
Lua Code:
function tim.sendQueuedMail()
if tim.mailQueueindex>0 then
if (tim.UpdateThrottle("SendQueuedMail", tim.throttleCountMail) == true) then
-- EINEN MailQueue-Eintrag senden (pro Aufruf dieser Funktion)
local mailboxwasopen=tim.MailBoxOpen
if tim.MailBoxOpen==false then
RequestOpenMailbox()
end
tim.wait4mail=true
tim.MailInQueue=tim.mailQueue.mTO[tim.mailQueueindex]
tim.MailInQueueSUB=tim.mailQueue.mSUB[tim.mailQueueindex]
SendMail(tim.mailQueue.mTO[tim.mailQueueindex], tim.mailQueue.mSUB[tim.mailQueueindex], tim.mailQueue.mTEXT[tim.mailQueueindex])
if mailboxwasopen==false then
CloseMailbox()
end
tim.mailQueueindex=tim.mailQueueindex-1
end
end
end