private void sendsmsOtp(string tomobile, string OTP)
{
string strUrl = "Here You can Pass your BulkSMS Url and Pass OTP and Tomobile Number Here";
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader(s);
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();
}
private void sendOTPEmail(string ToEmail, string OTP)
{
try
{
string fromaddress = "senderaddress@gmail.com";
string frompassword = "fromaddress mail passoword";
string body = string.Empty;
body = "OTP Password=" + OTP;
MailMessage mm = new MailMessage(fromaddress, ToEmail);
mm.Subject = "OTP";
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Gmail
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = fromaddress;
NetworkCred.Password = frompassword;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25; //gmail
smtp.Send(mm);
}
catch (Exception ex)
{
}
}
{
string strUrl = "Here You can Pass your BulkSMS Url and Pass OTP and Tomobile Number Here";
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader(s);
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();
}
private void sendOTPEmail(string ToEmail, string OTP)
{
try
{
string fromaddress = "senderaddress@gmail.com";
string frompassword = "fromaddress mail passoword";
string body = string.Empty;
body = "OTP Password=" + OTP;
MailMessage mm = new MailMessage(fromaddress, ToEmail);
mm.Subject = "OTP";
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Gmail
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = fromaddress;
NetworkCred.Password = frompassword;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25; //gmail
smtp.Send(mm);
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment