public void svcSendMail(clsMailInfo objMail) { try { if (EntsvcSendMail != null) { EntsvcSendMail(objMail); } } catch (Exception ex) { ex.Data.Add("My Key", "svcSendMail()--:--clsHttpAudio.cs--:--" + ex.Message + " :--:--"); //ClsException.LogError(ex); //ClsException.WriteToErrorLogFile(ex); System.Text.StringBuilder sb = new StringBuilder(); sb.AppendLine(ex.Message); sb.AppendLine(); sb.AppendLine("StackTrace : " + ex.StackTrace); sb.AppendLine(); sb.AppendLine("Location : " + ex.Data["My Key"].ToString()); sb.AppendLine(); sb1 = CreateTressInfo(); sb.Append(sb1.ToString()); VMuktiAPI.ClsLogging.WriteToTresslog(sb); } }
void clsMailDBService_EntsvcSendMail(clsMailInfo objMail) { try { System.Net.Mail.MailMessage mailMsg = new System.Net.Mail.MailMessage(); mailMsg.From = new System.Net.Mail.MailAddress(objMail.strFrom); mailMsg.To.Add(objMail.strTo); mailMsg.Subject = objMail.strSubject; mailMsg.SubjectEncoding = System.Text.Encoding.UTF8; mailMsg.Body = objMail.strMsg; mailMsg.BodyEncoding = System.Text.Encoding.UTF8; mailMsg.Priority = System.Net.Mail.MailPriority.High; mailMsg.IsBodyHtml = true; System.Net.Mail.SmtpClient SmtpMail = new System.Net.Mail.SmtpClient(objMail.strServer, objMail.intPort); SmtpMail.Credentials = new System.Net.NetworkCredential(objMail.strFrom, objMail.strPwd); SmtpMail.EnableSsl = true; SmtpMail.Send(mailMsg); } catch (Exception exp) { VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "clsMailDBService_EntsvcSendMail()", "clsMailDBService.xaml.cs"); } }
public void svcSendMail(clsMailInfo objMail) { if (EntsvcSendMail != null) { EntsvcSendMail(objMail); } }
public void SendEmailTo(string To, string Subject, string msg) { try { ClsException.WriteToLogFile("Calender: User sending Email"); ClsException.WriteToLogFile("Email Sending," + To + "," + Subject + "," + msg); if (SMTPServer.Equals("") || SMTPPort != -1 || SMTPUserName.Equals("") || SMTPPassword.Equals("")) { DataSet dsSMTP = ClsCalender.getSMTPCredentials(); foreach (DataRow drSMTP in dsSMTP.Tables[0].Rows) { string fieldName = drSMTP["FieldName"].ToString(); switch (fieldName) { case "SMTPServer": { SMTPServer = drSMTP["FieldValue"].ToString(); break; } case "SMTPPort": { SMTPPort = int.Parse(drSMTP["FieldValue"].ToString()); break; } case "SMTPUserName": { SMTPUserName = drSMTP["FieldValue"].ToString(); break; } case "SMTPPassword": { SMTPPassword = drSMTP["FieldValue"].ToString(); break; } default: break; } } } if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp) { clsMailInfo objMail = new clsMailInfo(); objMail.strFrom = SMTPUserName; objMail.strTo = To; objMail.strSubject = Subject; objMail.strMsg = msg; objMail.strServer = SMTPServer; objMail.intPort = SMTPPort; objMail.strPwd = SMTPPassword; clsMailDBClient.chHttpMailDBService.svcSendMail(objMail); } else { System.Net.Mail.MailMessage mailMsg = new System.Net.Mail.MailMessage(); mailMsg.From = new System.Net.Mail.MailAddress(SMTPUserName); mailMsg.To.Add(To); mailMsg.Subject = Subject; mailMsg.SubjectEncoding = System.Text.Encoding.UTF8; mailMsg.Body = msg; mailMsg.BodyEncoding = System.Text.Encoding.UTF8; mailMsg.Priority = System.Net.Mail.MailPriority.High; mailMsg.IsBodyHtml = true; System.Net.Mail.SmtpClient SmtpMail = new System.Net.Mail.SmtpClient(SMTPServer, SMTPPort); SmtpMail.Credentials = new System.Net.NetworkCredential(SMTPUserName, SMTPPassword); SmtpMail.EnableSsl = true; SmtpMail.Send(mailMsg); } } catch (Exception exp) { VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "SendEmailTo()", "ctlAddEvent.xaml.cs"); } }