hi .NET Gurus,
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>
/// Summary description for AlertSender
/// </summary>
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;
}
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<string>();
}
} // end class AlertSender
} // end namespace Example