In SharePoint default. alert functionality available. You can subscribe Alert on List or ListItem using AlertMe action. But in certain situation you need to automize this alert. Like Alert automatically send to particular user even though he/she did not subscribe event.
There are two way to do . Create feature that receive ItemAdded or ItemUpdated Event , Find out user and email address , send email using SendEmail Functionality of SharePoint.
Another way is use DynamicRecipient property of SPAlert.
Sample List :
Note : UserName must have email id associated with him.SMTP also configured properly for site.
Now run following code against your site. (use console application).
SPSite site = new SPSite("http://yoursite");
SPWeb web = site.OpenWeb();
SPList lst = web.Lists["Alert Test"];
SPAlert alert = web.Alerts.Add();
alert.AlertFrequency = SPAlertFrequency.Immediate;
alert.AlertType = SPAlertType.List;
alert.EventType = SPEventType.All;
alert.DynamicRecipient = "To";
alert.List = lst;
alert.Status = SPAlertStatus.On;
alert.Title = “Auto Email Alert”;
alert.Filter = "<Query><IsNotNull><FieldRef Name='To'></FieldRef></IsNotNull></Query>";
You can even use FeatureReceiver to install/ Activate / deactivate this thing as a feature.