I am new new to the .NET can someone help with the code. The code below is used to send alerts but i am able to receive only SMS when a user account is created successfully. I wanted to be able to send alert depending on the option selected(SMS/email) by the user while creating account. This is the part of the code from by DAL.
Any help would be greatly appreciated
using System.Net.Mail;
///
/// Summary description for AlertSender
///
namespace Exampl1
{
public class AlertSender
{
public AlertSender()
{
}
public bool HtmlFormatted = true;
public string EmailTo;
public string EmailFrom;
public string EmailSubject;
public string EmailBody;
public string SMSTo;
public string SMSPhoneNetwork;
public void EmailSend()
{
if (!string.IsNullOrEmpty(SMSTo))
{
EmailTo = "";
EmailTo = SMSTo.Replace("-","") + SMSPhoneNetworkToGateway(SMSPhoneNetwork);
HtmlFormatted = false;
}
if (string.IsNullOrEmpty(EmailFrom)) EmailFrom = "[email protected]";
MailMessage msg = new MailMessage(EmailFrom, EmailTo, EmailSubject, EmailBody);
msg.IsBodyHtml = HtmlFormatted;
SmtpClient client = new SmtpClient("localhost");
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.Send(msg);
}
private string SMSPhoneNetworkToGateway(string parmSMSSPhoneNetwork)
{
DBLib.DBOps DBWorker = new DBLib.DBOps("HealthETrax");
DBWorker.StoredProcName = "SMSGatewayFromPhoneNetwork";
DBWorker.ParamsInputSet("@PhoneNetworkName", parmSMSSPhoneNetwork);
return DBWorker.GetScalar();
}
} // end class AlertSender
} // end namespace Example
Suthish NairPosted Mar 16, 2011, 2:27 PM
Raja KrishnamurthyPosted Mar 16, 2011, 7:07 AM
HTH.
Happy Programming!!!
Regards,
Raja
ASPbeePosted Mar 15, 2011, 9:53 PM
thanks
Raja KrishnamurthyPosted Mar 14, 2011, 5:01 PM
HTH.
Regards,
Raja