I just noticed this:
res = executeSQLInsert ( "playermail", "'" .. playerTo .. ",'" .. message .. "','" .. title .. "', '0', '" .. from .. "'" )
Basically you are missing a ' before the comma at playerTo, so i am guessing that thats the reason why it doesnt work. So, this is how it should be like:
res = executeSQLInsert ( "playermail", "'" .. playerTo .. "','" .. message .. "','" .. title .. "', '0', '" .. from .. "'" )
I don't see a problem at your checkmail though , i am not playing mta that long but i've been working before with sql, dunno why it wont work