public EmailManager(string user, string password, string address, int? addressPort, bool? useSSL) { _emailer = new SMTPEmail.SMTPEMailS(null, address, user, password, addressPort, useSSL); if (String.IsNullOrEmpty(_xmlFolder)) _xmlFolder = Directory.GetCurrentDirectory(); _emailer.ThrowErrorOnSendingEmail = false; }
public EmailManager(EmailConfig config) { _emailer = new SMTPEmail.SMTPEMailS(null, config.Address, config.UserName, config.Password, config.Port, config.UseSSL); if (String.IsNullOrEmpty(config.xmlFolder)) _xmlFolder = Directory.GetCurrentDirectory(); _emailer.ThrowErrorOnSendingEmail = false; }
public EmailManager(EmailConfig config) { _emailer = new SMTPEmail.SMTPEMailS(null, config.Address, config.UserName, config.Password, config.Port, config.UseSSL); if (String.IsNullOrEmpty(config.xmlFolder)) _xmlFolder = @"C:\Users\S\Documents\visual studio 2010\Projects\MusubiMailer\EmailLibrary\EmailTemplates"; //Directory.GetCurrentDirectory(); _emailer.ThrowErrorOnSendingEmail = true; }
public ActionResult FeedBack(object model) { string subject = Request["Subject"]; string message = Request["Message"]; if (String.IsNullOrEmpty(subject)) { ValidationErrors.Add("NoSubject", "Please enter a subject"); } if (String.IsNullOrEmpty(message)) { ValidationErrors.Add("NoMessage", "Please enter a message"); } if (ValidationErrors.Count == 0) { //Send out the email string emailAddress = ConfigurationManager.AppSettings["FeedBackEmailAddress"]; StringBuilder sbBody = new StringBuilder(); sbBody.Append("FeedBack for LFMore.com \n"); string memberInfo = (MemberInfo != null) ? MemberInfo.MemberID.ToString() : "Not a Member"; string lastPageVisited = (Session[GlobalConst.SESSION_CURRENT_ACTION] != null) ? Session[GlobalConst.SESSION_CURRENT_ACTION].ToString() : "None"; sbBody.Append(String.Format("Subject:{0} \n MemberID: {1} \n Last Page Visited: {2} \n", subject, memberInfo, lastPageVisited)); sbBody.Append(message); bool success = false; try { SMTPEmail.SMTPEMailS email = new SMTPEmail.SMTPEMailS(null); //string emailFileLocation = Server.MapPath("~/Static/InviteEmail.txt"); success = email.SendEmail(new string[] { emailAddress }, "*****@*****.**", "Feedback for LFMore", sbBody.ToString(), null, false); } catch (Exception ex) { //TODO: We really want to know if this fails. Its possible to capture all the failures and then email them out later } TempData[GlobalConst.TEMPDATA_CONFIRMATION_MESSAGE] = "Your feedback has been sent. Thank you for helping to make LFMore a better place!"; return RedirectToAction("Confirmation", "Shared"); } else { RegisterErrorsWithModel(); } return View(); }
//[NoCache] cache so that if users enter the same emai twice nothing happens public JsonResult InviteViaEmailAJAX(string e) { string emailAddress = e; if(!Validate.Email(emailAddress)) { ValidationErrors.Add("Invalid Email", Errors.INVALID_EMAIL); } CommitResponse response = new CommitResponse() { success = false }; if (ValidationErrors.Count == 0) { //Capture the Invitation accountInterface.CaptureEmailInvite(MemberInfo.MemberID, emailAddress, CurrentEvent.EventID); //Send out the email Dictionary<string, string> replaceValues = new Dictionary<string, string>(); replaceValues.Add("INVITERS_EMAIL", MemberInfo.Email); string gameName = gameInterface.GetGameByID(CurrentEvent.GameID).GameName; replaceValues.Add("GAME_NAME", gameName); string eventTypeName = eventInterface.GetEventTypeByID(CurrentEvent.EventID).EventTypeName; replaceValues.Add("EVENT_TYPE", eventTypeName); replaceValues.Add("EVENT_LINK", CurrentEvent.GenerateEventURL(System.Web.HttpContext.Current)); try { SMTPEmail.SMTPEMailS email = new SMTPEmail.SMTPEMailS(replaceValues); string emailFileLocation = Server.MapPath("~/Static/InviteEmail.txt"); response.success = email.SendEmailFromFile(new string[] { emailAddress }, "*****@*****.**", "A friend has invited you to a Group", emailFileLocation, null, false); } catch (Exception ex) { //TODO: We really want to know if this fails. Its possible to capture all the failures and then email them out later } } return new JsonResult() { Data = response }; }