update GUI and finish the function of sending mail