function PopupCenter(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var targetWin = window.open(pageURL, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + w + ',height=' + h + ',top=' + top + ',left=' + left + ',modal=1');
return false;
}
Tuesday, August 17, 2010
Popup
Posted by Nitin Khanna at 6:44 PM 2 comments
Thursday, August 12, 2010
MailManager
#region Mail Manager
public class MailManager
{
#region Properties
public string SenderEmail { get; set; }
public string RecipientEmail { get; set; }
public string CcToEmail { get; set; }
public string Subject { get; set; }
public string MailBody { get; set; }
public bool IsBodyHTML { get; set; }
public bool IsCCToSelf { get; set; }
#endregion
#region Send Mail
public void sendMail()
{
try
{
MailMessage mail = new MailMessage();
//if (string.IsNullOrEmpty(recipientEmail))
//{
// recipientEmail = ConfigurationManager.AppSettings.Get("AdminEmail");
//}
mail.To.Add(RecipientEmail);
mail.Subject = Subject;
mail.IsBodyHtml = IsBodyHTML;
if (!string.IsNullOrEmpty(CcToEmail))
{
mail.CC.Add(CcToEmail);
}
mail.Body = MailBody.ToString();
if (IsCCToSelf)
{
mail.Bcc.Add(new MailAddress(SenderEmail));
}
Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
if (mailSettings != null)
{
SmtpClient smtp = new SmtpClient();
int port = mailSettings.Smtp.Network.Port;
string host = mailSettings.Smtp.Network.Host;
if (string.IsNullOrEmpty(SenderEmail))
{
mail.From = new MailAddress(mailSettings.Smtp.From);
}
else
{
mail.From = new MailAddress(SenderEmail);
}
string password = mailSettings.Smtp.Network.Password;
string username = mailSettings.Smtp.Network.UserName;
smtp.Host = host;
smtp.Send(mail);
}
}
catch (Exception)
{
throw;
}
finally
{
}
}
#endregion
}
#endregion
var smtp1 = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential("fd@gmail.com", "s")
};
Posted by Nitin Khanna at 10:01 AM 0 comments
Labels: MailManager