fixed missing loop increment in smtp
refactoring doubly package insert
doubly package insert_before_and_mark function