refactor phpMailer