It was my mistake, I couldn't even relay using command prompt. When I was able to send emails with command prompt, my app also started working.

Thanks.