public static void sendEmailRegistration(String strBody, String strSubject, String strRegistrantEmail) { try { MailMessage mmMessage = new MailMessage(); mmMessage.To.Add(new MailAddress("*****@*****.**")); mmMessage.From = new MailAddress(ConfigurationManager.AppSettings["EmailFrom"].ToString()); mmMessage.Subject = strSubject; mmMessage.Body = strBody; mmMessage.IsBodyHtml = true; sendEmail(mmMessage); // send confirmation email to registrant StringBuilder sb = new StringBuilder(); sb.AppendLine("<br /><br />"); sb.AppendLine("Eclipse Athletic Director,<br />"); sb.AppendLine("Mike McCombs<br />"); sb.AppendLine("[email protected]<br />"); sb.AppendLine("402-339-1396"); mmMessage = new MailMessage(); mmMessage.To.Add(new MailAddress(strRegistrantEmail)); mmMessage.From = new MailAddress("*****@*****.**"); mmMessage.Subject = "Confirmation of " + strSubject; mmMessage.Body = strBody + sb.ToString(); mmMessage.IsBodyHtml = true; sendEmail(mmMessage); } catch (Exception Ex) { BeaconHelpers.WriteToErrorLog(Ex.ToString(), "Error in sendEmail{1)"); } }
public static void sendEmail(MailMessage oMessage) { try { Int32 iPort = 25; SmtpClient objSMTP = new SmtpClient(); objSMTP.Host = ConfigurationManager.AppSettings["SMTPSvr"]; String sPort = ConfigurationManager.AppSettings["SMTPPort"]; Int32.TryParse(sPort, out iPort); objSMTP.Port = iPort; String sSMTPUser = ConfigurationManager.AppSettings["SMTPUser"].ToString(); if (sSMTPUser.Length > 0) { NetworkCredential oCredential = new NetworkCredential(sSMTPUser, ConfigurationManager.AppSettings["SMTPAuth"].ToString()); objSMTP.UseDefaultCredentials = false; objSMTP.Credentials = oCredential; } objSMTP.Send(oMessage); oMessage.Dispose(); } catch (Exception Ex) { BeaconHelpers.WriteToErrorLog(Ex.ToString(), "Error in sendEmail"); } }
public static void sendEmail(String strSubject, String strBody, String strNotificationEmail) { try { Char[] arrEmailAddressDelims = { ',', ';', ' ' }; String[] arrToAddresses = strNotificationEmail.Split(arrEmailAddressDelims); MailMessage mmMessage = new MailMessage(); foreach (String strTo in arrToAddresses) { mmMessage.To.Add(new MailAddress(strTo)); } mmMessage.From = new MailAddress(ConfigurationManager.AppSettings["EmailFrom"].ToString()); mmMessage.Subject = strSubject; mmMessage.Body = strBody; sendEmail(mmMessage); } catch (Exception Ex) { BeaconHelpers.WriteToErrorLog(Ex.ToString(), "Error in sendEmail{1)"); } }
public static void sendEmailRegistration2(String strBody, String strSubject, String strRegistrantEmail) { try { MailMessage mmMessage = new MailMessage(); mmMessage.To.Add(new MailAddress("*****@*****.**")); mmMessage.From = new MailAddress(ConfigurationManager.AppSettings["EmailFrom"].ToString()); mmMessage.Subject = strSubject; mmMessage.Body = strBody; mmMessage.IsBodyHtml = true; sendEmail(mmMessage); // send confirmation email to registrant StringBuilder sb = new StringBuilder(); sb.AppendLine("<br /><br /><br />Click <a id='waiverform' href='http://omahaeclipse.com/Forms/Omaha Eclipse Waiver.pdf'>here</a> to download waiver form."); sb.AppendLine("<br />Bring signed waiver to first day of camp. Boys will not be allowed to participate without a signed waiver."); sb.AppendLine("<br /><br />I received your registration for our Summer Football Camp, thank you!"); sb.AppendLine("<br /><br />"); sb.AppendLine("If you have any questions feel free to contact me, all my contact info is on the website."); sb.AppendLine("<br /><br />"); sb.AppendLine("Eclipse Athletic Director,<br />"); sb.AppendLine("Mike McCombs<br />"); sb.AppendLine("[email protected]<br />"); sb.AppendLine("402-339-1396"); mmMessage = new MailMessage(); mmMessage.To.Add(new MailAddress(strRegistrantEmail)); mmMessage.From = new MailAddress("*****@*****.**"); mmMessage.Subject = "Confirmation of " + strSubject; mmMessage.Body = strBody + sb.ToString(); mmMessage.IsBodyHtml = true; sendEmail(mmMessage); } catch (Exception Ex) { BeaconHelpers.WriteToErrorLog(Ex.ToString(), "Error in sendEmail{1)"); } }