add nested if to prevent page breaking on email error
Merge pull request #31 from lrakhman/email-redirection

add nested if to prevent page breaking on email error