added if statement for mail