MYOC - E-mail Invite Notification
In this blog we’ll see how e-mail notifications can be sent to the participants to cast their vote for a poll using Microsoft live.
1. To send e-mails to the participants with the poll details, MYOC sends it through live server. It requires a valid live id to send e-mails. Below are the configuration settings used -
<Setting name="SmtpServer" value="smtp.live.com" />
<Setting name="SmtpUsername" value="myLiveId@live.com" />
<Setting name="SmtpPassword" value="****" />
<Setting name="SmtpPort" value="25" />
<Setting name="FromAddress" value="myUserId@myDomain.com" />
2. Create the message to be sent, get the e-mail IDs of the participants and write the code below to send e-mails from a specified address.
string messageToSend = "Hi, Please participate in this poll";
string emailIds = "Hi, Please participate in this poll";
(new SmtpClient(RoleManager.GetConfigurationSetting("SmtpServer"), int.Parse(RoleManager.GetConfigurationSetting("SmtpPort")))
{
Credentials = new System.Net.NetworkCredential(RoleManager.GetConfigurationSetting("SmtpUsername"), RoleManager.GetConfigurationSetting("SmtpPassword")),
EnableSsl = true
}).Send(RoleManager.GetConfigurationSetting("FromAddress"), emailIds, "MYOC Notification: You have been invited", messageToSend);
In this way e-mail notifications can be sent to participants.


