It's hard to help without any detailed exception/error faced by the original poster.
However you can see a working example regarding send e-mail with attachment.