using System;
using System.Configuration;
using System.Net.Mail;
using System.Text;
///
/// Summary description for MailServicesCls
///
///
public class MailServicesCls
{
EMUPDataContext dbEmup = new EMUPDataContext();
public MailServicesCls()
{
//
// TODO: Add constructor logic here
//
}
public void SendeMail(string strToMailId, string strSubject, string strBody)
{
try
{
MailFormat(strToMailId, strSubject, strBody);
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
//public void SendeMail(string strToMailId, string strSubject, string strMailBody)
//{
// try
// {
// MailFormat(strToMailId, strSubject, strMailBody);
// }
// catch (SmtpException ex)
// {
// throw new ApplicationException
// ("SmtpException has occured: " + ex.Message);
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
public void SendMaidPostAdConfirmation(string strUserName, string strAdTitle, string strUserMailId, Int16 intAdId)
{
try
{
SmtpClient mySmtpClient = new SmtpClient("email-smtp.us-west-2.amazonaws.com");
string strMsg;
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("AKIAJP3JQRRLCEF6PSQA", "AnG1zBSPy6RD8XtRYIiAzcP+aVvOtaZKMit5x+oGuZMG");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("shailesh@jhalak.com", "Jhalak Team");
MailAddress to = new MailAddress(strUserMailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
//MailAddress replyto = new MailAddress("reply@example.com");
//myMail.ReplyTo = replyto;
// set subject and encoding
myMail.Subject = strAdTitle;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
strMsg = "
" + "Hi " + strUserName + "," + "
";
strMsg += "Thanks for creating your Ad ." + strAdTitle + "Ad Id:" + intAdId + "In www.Jhalak.com .
";
strMsg += "You can view, edit, delete and check replies to all your ads by using My Account .
";
strMsg += "You can view, edit, delete and check replies to all your ads by using 'My Account'.
";
strMsg += "Thank you for using Jhalak and good luck with your ad! Remember, Jhalak is the best place for you
";
strMsg += "to buy, sell, rent or find anything - from used goods to cars to flats to jobs... and everything in between!
";
strMsg += "";
strMsg += "";
strMsg += "Thanks,";
strMsg += "";
strMsg += "";
strMsg += "Team Sudimna, ";
strMsg += "www.Jhalak.com";
myMail.Body += strMsg;
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
public void SendeMailResetPassword(string strToMailId, string strSubject, string UserName, string strResetLink)
{
try
{
var strBody = new StringBuilder();
strBody.AppendLine(UserName);
strBody.Append("," + "
");
strBody.AppendLine(" We have received your password reset request. This email contains the information that you need to change your password.
");
strBody.AppendLine("Your MailId :" + strToMailId + "
");
strBody.AppendLine("You can login here " + strResetLink + " to change or reset password" + "
");
strBody.AppendLine("If you did not request that your password be reset, then you should send an email to support@sudimna.com as soon as possible to ensure the safety of your account. " + "
");
strBody.AppendLine("Best Regards, " + "
");
strBody.AppendLine("Sudimna Team" + "
");
strBody.AppendLine("Replies to this message are undeliverable. Please do not reply.");
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("jhalak.team@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("jhalak.team@sudimna.com", "Jhalak Team");
MailAddress to = new MailAddress(strToMailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
myMail.Subject = strSubject;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
myMail.Body = Convert.ToString(strBody);
myMail.BodyEncoding = System.Text.Encoding.UTF8;
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (SmtpException ex)
{
throw new ApplicationException
("SmtpException has occured: " + ex.Message);
}
catch (Exception ex)
{
throw ex;
}
}
//public bool AdResponseMail(string OwnerMailId, string ownerName, string strUserName)
//{
// News_Letter clsNewsLetter = new News_Letter();
// MailMessage strMailMsg = null;
// const String FROM = "admin@jhalak.com";
// string TO = OwnerMailId;
// string SUBJECT = "Jhalak-:- Ad Response from " + strUserName;
// StringBuilder MailBody = new StringBuilder();
// MailBody.AppendLine(clsNewsLetter.UserAcknowledgementMail(ownerName, strUserName));
// // strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
// strMailMsg = new MailMessage();
// strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
// strMailMsg.To.Add(TO);
// strMailMsg.Subject = SUBJECT;
// strMailMsg.Body = MailBody.ToString();
// strMailMsg.IsBodyHtml = true;
// String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
// String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
// String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// // STARTTLS to encrypt the connection.
// const int PORT = 587;
// // Create an SMTP client with the specified host name and port.
// using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
// {
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// // Send the email.
// try
// {
// client.Send(strMailMsg);
// // client.Send(FROM, TO, SUBJECT, MailBody.ToString());
// }
// catch (Exception ex)
// {
// return false;
// }
// }
// return true;
//}
public bool AdResponseMail(string OwnerMailId, string ownerName, string strUserName)
{
News_Letter clsNewsLetter = new News_Letter();
MailMessage strMailMsg = null;
try
{
const String FROM = "admin@jhalak.com";
string TO = OwnerMailId;
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("ac@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
string SUBJECT = "Jhalak-:- Ad Response from " + strUserName;
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.UserAcknowledgementMail(ownerName, strUserName));
// strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
strMailMsg = new MailMessage();
strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
strMailMsg.To.Add(TO);
strMailMsg.Subject = SUBJECT;
strMailMsg.Body = MailBody.ToString();
strMailMsg.IsBodyHtml = true;
mySmtpClient.Send(strMailMsg);
//String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
//String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
//// Amazon SES SMTP host name. This example uses the US West (Oregon) region.
//String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
//// Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
//// STARTTLS to encrypt the connection.
//const int PORT = 587;
//// Create an SMTP client with the specified host name and port.
//using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
//{
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// Send the email.
// client.Send(FROM, TO, SUBJECT, MailBody.ToString());
}
catch (Exception ex)
{
return false;
}
//}
return true;
}
private void MailFormat(string strToMailId, string strSubject, string strBody)
{
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("jhalak.team@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("jhalak.team@sudimna.com", "Jhalak Team");
MailAddress to = new MailAddress(strToMailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
//MailAddress replyto = new MailAddress("jhalak.sudimna@sudimna.com");
//myMail.ReplyTo = replyto;
// set subject and encoding
myMail.Subject = strSubject;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
myMail.Body = "" + strBody + "
using HTML.";
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
try
{
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
throw ex;
}
}
class clsTeamMails
{
public string mailId { get; set; }
public int id { get; set; }
}
public bool SignUpConfirmation(string strPlayerMailid, string strUserName)
{
News_Letter clsNewsLetter = new News_Letter();
MailMessage strMailMsg = null;
const String FROM = "admin@jhalak.com";
string TO = strPlayerMailid;
string SUBJECT = "Jhalak-:- Player Signup confirmation";
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.UserAcknowledgement(strUserName,""));
// strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
strMailMsg = new MailMessage();
strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
strMailMsg.To.Add(TO);
strMailMsg.Subject = SUBJECT;
strMailMsg.Body = MailBody.ToString();
strMailMsg.IsBodyHtml = true;
String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// Amazon SES SMTP host name. This example uses the US West (Oregon) region.
String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// STARTTLS to encrypt the connection.
const int PORT = 587;
// Create an SMTP client with the specified host name and port.
using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
{
// Create a network credential with your SMTP user name and password.
client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
client.EnableSsl = true;
// Send the email.
try
{
client.Send(strMailMsg);
// client.Send(FROM, TO, SUBJECT, MailBody.ToString());
}
catch (Exception ex)
{
return false;
}
}
return true;
}
public bool WriteNews(string strUsername, string strUserMailId, string strSubject,string strSummary)
{
News_Letter clsNewsLetter = new News_Letter();
MailMessage strMailMsg = null;
const String FROM = "admin@jhalak.com";
string TO = strUserMailId;
string SUBJECT = "Cricket:- Tournament News";
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.WriteNews(strUsername,strSummary));
strMailMsg = new MailMessage();
strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
strMailMsg.To.Add(TO);
strMailMsg.Subject = SUBJECT;
strMailMsg.Body = MailBody.ToString();
strMailMsg.IsBodyHtml = true;
String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// Amazon SES SMTP host name. This example uses the US West (Oregon) region.
String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// STARTTLS to encrypt the connection.
const int PORT = 587;
// Create an SMTP client with the specified host name and port.
using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
{
// Create a network credential with your SMTP user name and password.
client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
client.EnableSsl = true;
// Send the email.
try
{
client.Send(strMailMsg);
// client.Send(FROM, TO, SUBJECT, MailBody.ToString());
}
catch (Exception ex)
{
return false;
}
}
return true;
}
public bool BookTicketMail(string OwnerMailId, string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
{
News_Letter clsNewsLetter = new News_Letter();
try
{
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("copyright@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("admin@jhalak.com", "Jhalak.Com");
MailAddress to = new MailAddress(OwnerMailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
// Add a carbon copy recipient.
MailAddress copy = new MailAddress("shailesh.gajula@sudimna.com");
myMail.CC.Add(copy);
MailAddress Bcopy = new MailAddress("rama.chinta@jhalak.com");
myMail.Bcc.Add(Bcopy);
myMail.Subject = "Jhalak-:- Event Response from " + OwnerMailId;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.BookEventMail(OwnerMailId, Eventname, NoOftkts, Ttlcost, EventDate, Loc));
myMail.Body = MailBody.ToString();
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
}
return true;
}
public bool BookTicketMail(string buyerName,string organizerName,string orderNo,string serviceFee,string ticketType, string BuyerEmailId,string OrganizerMailid, string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
{
News_Letter clsNewsLetter = new News_Letter();
try
{
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("copyright@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("admin@jhalak.com", "Jhalak.Com");
MailAddress to = new MailAddress(BuyerEmailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
// Add a carbon copy to organizer.
MailAddress copyOrganizer = new MailAddress(OrganizerMailid);
myMail.CC.Add(copyOrganizer);
// Add a bcc copy recipient.
MailAddress copy = new MailAddress("shailesh.gajula@sudimna.com");
myMail.Bcc.Add(copy);
MailAddress Bcopy = new MailAddress("rama.chinta@jhalak.com");
myMail.Bcc.Add(Bcopy);
myMail.Subject = "Your Tickets Order #" + orderNo +"-" + Eventname ;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.BookEventMail(buyerName,organizerName,orderNo,serviceFee,ticketType,BuyerEmailId, Eventname, NoOftkts, Ttlcost, EventDate, Loc));
myMail.Body = MailBody.ToString();
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
}
return true;
}
public bool BookTicketMailCopy(string JhalakAdmin, string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
{
News_Letter clsNewsLetter = new News_Letter();
try
{
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("copyright@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("admin@jhalak.com", "Jhalak.Com");
MailAddress to = new MailAddress(JhalakAdmin);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
myMail.Subject = "Jhalak-:- Event Response from " + JhalakAdmin;
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.BookEventMail(JhalakAdmin, Eventname, NoOftkts, Ttlcost, EventDate, Loc));
myMail.Body = MailBody.ToString();
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
}
return true;
}
//public bool BookTicketMail(string OwnerMailId, string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
//{
// News_Letter clsNewsLetter = new News_Letter();
// MailMessage strMailMsg = null;
// const String FROM = "admin@jhalak.com";
// string TO = OwnerMailId;
// string SUBJECT = "Jhalak-:- Event Response from " + OwnerMailId;
// StringBuilder MailBody = new StringBuilder();
// MailBody.AppendLine(clsNewsLetter.BookEventMail(OwnerMailId,Eventname, NoOftkts, Ttlcost, EventDate, Loc));
// // strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
// strMailMsg = new MailMessage();
// strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
// strMailMsg.To.Add(TO);
// strMailMsg.Subject = SUBJECT;
// strMailMsg.Body = MailBody.ToString();
// strMailMsg.IsBodyHtml = true;
// String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
// String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
// String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// // STARTTLS to encrypt the connection.
// const int PORT = 587;
// // Create an SMTP client with the specified host name and port.
// using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
// {
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// // Send the email.
// try
// {
// client.Send(strMailMsg);
// // client.Send(FROM, TO, SUBJECT, MailBody.ToString());
// }
// catch (Exception ex)
// {
// return false;
// }
// }
// return true;
//}
public bool BookTicketOrganizerMail(string OrgMailId, string BuyerName, string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
{
News_Letter clsNewsLetter = new News_Letter();
try
{
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("copyright@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
MailAddress from = new MailAddress("admin@jhalak.com", "Jhalak.Com");
MailAddress to = new MailAddress(OrgMailId);
MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
myMail.Subject = "Jhalak-:- Event Ticket Buyer Details from " + "admin@jhalak.com";
myMail.SubjectEncoding = System.Text.Encoding.UTF8;
// set body-message and encoding
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.BookEventMailtoOrganizer(OrgMailId, BuyerName, Eventname, NoOftkts, Ttlcost, EventDate, Loc));
myMail.Body = MailBody.ToString();
myMail.BodyEncoding = System.Text.Encoding.UTF8;
// text or html
myMail.IsBodyHtml = true;
mySmtpClient.Send(myMail);
}
catch (Exception ex)
{
}
return true;
}
//public bool BookTicketOrganizerMail(string OrgMailId,string BuyerName , string Eventname, string NoOftkts, string Ttlcost, string EventDate, string Loc)
//{
// News_Letter clsNewsLetter = new News_Letter();
// MailMessage strMailMsg = null;
// const String FROM = "admin@jhalak.com";
// string TO = OrgMailId;
// string SUBJECT = "Jhalak-:- Event Ticket Buyer Details from " + "admin@jhalak.com";
// StringBuilder MailBody = new StringBuilder();
// MailBody.AppendLine(clsNewsLetter.BookEventMailtoOrganizer(OrgMailId, BuyerName, Eventname, NoOftkts, Ttlcost, EventDate, Loc));
// // strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
// strMailMsg = new MailMessage();
// strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
// strMailMsg.To.Add(TO);
// strMailMsg.Subject = SUBJECT;
// strMailMsg.Body = MailBody.ToString();
// strMailMsg.IsBodyHtml = true;
// String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
// String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
// String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// // STARTTLS to encrypt the connection.
// const int PORT = 587;
// // Create an SMTP client with the specified host name and port.
// using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
// {
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// // Send the email.
// try
// {
// client.Send(strMailMsg);
// // client.Send(FROM, TO, SUBJECT, MailBody.ToString());
// }
// catch (Exception ex)
// {
// return false;
// }
// }
// return true;
//}
#region password
public bool ForgotPassword(string struserMaildId, string userName,string strPwd)
{
News_Letter clsNewsLetter = new News_Letter();
MailMessage strMailMsg = null;
const String FROM = "admin@jhalak.com";
string TO = struserMaildId;
string SUBJECT = "Jhalak-:- Reset Password";
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.ForgotPasswrod(userName,strPwd));
strMailMsg = new MailMessage();
strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
strMailMsg.To.Add(struserMaildId);
strMailMsg.Subject = SUBJECT;
strMailMsg.Body = MailBody.ToString();
// strMailMsg = new MailMessage(strMailMsg.From.ToString(), strUserMailid, SUBJECT, MailBody.ToString());
strMailMsg.IsBodyHtml = true;
String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// Amazon SES SMTP host name. This example uses the US West (Oregon) region.
String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// STARTTLS to encrypt the connection.
const int PORT = 587;
// Create an SMTP client with the specified host name and port.
using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
{
// Create a network credential with your SMTP user name and password.
client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
client.EnableSsl = true;
// Send the email.
try
{
client.Send(strMailMsg);
// client.Send(FROM, TO, SUBJECT, MailBody.ToString());
}
catch (Exception ex)
{
return false;
}
}
return true;
}
#endregion
//public bool BusinessEnquiry(string OwnerMailId, string ownerName, string strUserName)
//{
// News_Letter clsNewsLetter = new News_Letter();
// MailMessage strMailMsg = null;
// const String FROM = "admin@jhalak.com";
// string TO = OwnerMailId;
// string SUBJECT = "Jhalak-:- Business Enquiry from " + strUserName;
// StringBuilder MailBody = new StringBuilder();
// MailBody.AppendLine(clsNewsLetter.UserAcknowledgementMail(ownerName, strUserName));
// // strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
// strMailMsg = new MailMessage();
// strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
// strMailMsg.To.Add(TO);
// strMailMsg.Subject = SUBJECT;
// strMailMsg.Body = MailBody.ToString();
// strMailMsg.IsBodyHtml = true;
// String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
// String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
// // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
// String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
// // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
// // STARTTLS to encrypt the connection.
// const int PORT = 587;
// // Create an SMTP client with the specified host name and port.
// using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
// {
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// // Send the email.
// try
// {
// client.Send(strMailMsg);
// // client.Send(FROM, TO, SUBJECT, MailBody.ToString());
// }
// catch (Exception ex)
// {
// return false;
// }
// }
// return true;
//}
public bool BusinessEnquiry(string OwnerMailId, string ownerName, string strUserName)
{
News_Letter clsNewsLetter = new News_Letter();
MailMessage strMailMsg = null;
try
{
const String FROM = "admin@jhalak.com";
string TO = OwnerMailId;
SmtpClient mySmtpClient = new SmtpClient("smtpout.secureserver.net");
mySmtpClient.UseDefaultCredentials = false;
System.Net.NetworkCredential basicAuthenticationInfo = new
System.Net.NetworkCredential("ac@sudimna.com", "saibaba");
mySmtpClient.Credentials = basicAuthenticationInfo;
string SUBJECT = "Jhalak-:- Business Enquiry from " + strUserName;
StringBuilder MailBody = new StringBuilder();
MailBody.AppendLine(clsNewsLetter.UserAcknowledgementMail(ownerName, strUserName));
// strMailMsg = new MailMessage(FROM, strPlayerMailid, SUBJECT, MailBody.ToString());
strMailMsg = new MailMessage();
strMailMsg.From = new MailAddress(FROM, "Jhalak.Com");
strMailMsg.To.Add(TO);
strMailMsg.Subject = SUBJECT;
strMailMsg.Body = MailBody.ToString();
strMailMsg.IsBodyHtml = true;
mySmtpClient.Send(strMailMsg);
//String SMTP_USERNAME = Convert.ToString(ConfigurationManager.AppSettings["SMTP-User"]);
//String SMTP_PASSWORD = Convert.ToString(ConfigurationManager.AppSettings["SMTP-PWD"]); // Replace with your SMTP password.
//// Amazon SES SMTP host name. This example uses the US West (Oregon) region.
//String HOST = Convert.ToString(ConfigurationManager.AppSettings["SMTP-Host"]);
//// Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
//// STARTTLS to encrypt the connection.
//const int PORT = 587;
//// Create an SMTP client with the specified host name and port.
//using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
//{
// // Create a network credential with your SMTP user name and password.
// client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);
// // Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then
// // the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
// client.EnableSsl = true;
// Send the email.
// client.Send(FROM, TO, SUBJECT, MailBody.ToString());
}
catch (Exception ex)
{
return false;
}
//}
return true;
}
}