Please refer links:
Link1
Link2
I would suggest you to use this code and create a custom DLL called Utilities define a method SendMail().
Call the SendMail(to, from, subject,message) whenever you wish to send email to user.
If you have any question, please ask.
Thanks.