updated emaillog sql