public void Emailer_CreateONT() { var emailer = new Emailer(); const DefinedEmailType emailType = DefinedEmailType.CreateONT; IEnumerable<string> addresses = null; ItxOrder itxOrder = null; const int masterOrderId = 0; // For the CreateONT path, the From and To address is being read from the configuration file key - SupportEmail // Important - if that is not a valid email address, you will get an error message: Mailbox unavailable. The server response was: 5.1.1 User Unknown // The following is actually used in the text of the email under "Created by:" const string userEmail = "*****@*****.**"; // equipment criteria var criteria = new EquipmentCriteriaDto { SerialNumber = "fakeSerialNumber", Model = "fakeONTModel", Status = "fakeStatus", LocationId = "fakeLocationId", }; const string manufacturer = "fakeManufacturer"; emailer.Send(emailType, addresses, itxOrder, masterOrderId, userEmail, criteria, manufacturer); }
public ActionResult Register(RegisterViewModel model) { if (_userService.EmailInUse(model.Email)) { ModelState.AddModelErrorFor <RegisterViewModel>(m => m.Email, "Email is already in use by another user."); } if (IsModelValidAndPersistErrors()) { User user = _userService.Register(model.Email, model.Password, Request.UserHostAddress); SetSuccess("Account successfully created."); WelcomeEmail welcomeEmail = Emailer.Welcome(user.Email, model.Password, Url.Action("Login", "Security")); welcomeEmail.SendAsync(); return(RedirectToAction("Login")); } return(RedirectToSelf()); }
public Task SendAsync(IdentityMessage message) { var smtpFrom = System.Configuration.ConfigurationManager.AppSettings["smtpFrom"]; IEmailer emailer = new Emailer(); EmailInfo identityMessage = new EmailInfo() { From = smtpFrom, TextBody = message.Body, Subject = message.Subject, }; identityMessage.To.Add(message.Destination); return(emailer.SendEmailAsync(identityMessage)); }
public Task SendAsync(IdentityMessage message) { // Plug in your email service here to send an email. if (string.IsNullOrWhiteSpace(message.Body)) { return(Task.FromResult(false)); } if (string.IsNullOrWhiteSpace(message.Destination)) { message.Destination = EmailAndSmtpSetting.DefaultEmailReceiver; } var toEmails = message.Destination?.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); if (toEmails == null || toEmails.Length == 0) { return(Task.FromResult(false)); } string[] ccEmails, bccEmails; bool isBodyHtml = false; string fromEmail, displayName; EmailMessage emailMsg = message as EmailMessage; if (emailMsg != null) { fromEmail = emailMsg.SenderEmail; displayName = emailMsg.SenderDisplayName; isBodyHtml = emailMsg.IsBodyHtml; ccEmails = emailMsg.CC.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); bccEmails = emailMsg.BCC.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); } else { ccEmails = null; bccEmails = null; fromEmail = null; // we'll use the default displayName = null; // we'll use the default } var sent = Emailer.SendEmail(fromEmail, message.Body, message.Subject, null, toEmails, ccEmails, bccEmails, isBodyHtml, displayName); return(Task.FromResult(sent)); }
static void Main(string[] args) { bool errored = false; string mssg = string.Empty; try { //throw new Exception("test exception"); Emailer emailer = new Emailer( ConfigurationSettings.AppSettings["smtpServer"].ToString(), ConfigurationSettings.AppSettings["smtpUser"].ToString(), ConfigurationSettings.AppSettings["smtpPassword"].ToString(), ConfigurationSettings.AppSettings["emailGeneral"].ToString(), Int32.Parse(ConfigurationSettings.AppSettings["smtpPort"].ToString()) ); emailer.SendNotifications(); } catch (Exception exc) { errored = true; mssg = exc.ToString(); } finally { if (!errored) { mssg = "Successfully completed"; } string log = "-------------------------------------"; log = Environment.NewLine + DateTime.Now.ToString("F") + Environment.NewLine + mssg + Environment.NewLine; log += "-------------------------------------"; TextWriterTraceListener logListener = new TextWriterTraceListener("EmailReminderLog.txt", "EmailReminderLog"); Trace.Listeners.Add(logListener); Trace.WriteLine(log); Trace.Flush(); } }
public ActionResult Register(RegisterModel postedModel) { if (RavenSession.Query <User>().Any(x => x.Email == postedModel.Email)) { ModelState.AddModelError("Email", "An account is already created for this email."); } if (!ModelState.IsValid) { return(View(postedModel)); } var onboardProcess = new UserOnboardProcess(RavenSession); var user = onboardProcess.RegisterNewTrial(postedModel.Name, postedModel.Email, Hash(postedModel.Password)); try { var emailer = new Emailer(null); emailer.SendEmail(EmailEnum.NewAccountOpen, postedModel.Email, string.Empty, 0); emailer.SendEmail(EmailEnum.CompanyNewUserNotification, postedModel.Email, string.Empty, 0); //SendGridEmailer.NewAccountOpened(postedModel.Email); //SendGridEmailer.CompanyNewUserNotification(postedModel.Email); var mc = new MailchimpApi(); if (postedModel.SubscribeToGeneral) { mc.SubscribeToGeneralUpdates(postedModel.Email); } mc.SubscribeToGettingStarted(postedModel.Email); } catch (Exception) { //eat it } FormsAuthHelper.SetAuthenticationCookie(Response, user); HighFive("Welcome to your free trial!"); return(RedirectToAction("Thanks", "Home")); }
/// <summary> /// When the timer ticks, on every second, we update the skill. /// </summary> private void UpdateOnTimerTick() { if (!IsPaused) { var skillsCompleted = new LinkedList <QueuedSkill>(); // Remove all of the completed skills while (Items.Count > 0) { QueuedSkill skill = Items[0]; Skill skillTrained = skill.Skill; if (!skill.IsCompleted) { // Still training, stop loop and update the skill (ESI does not move skills // from skill queue to skill list until login) skillTrained?.UpdateSkillProgress(skill); break; } // Check that it is in fact completed if (skill.IsCompleted && skillTrained != null && skillTrained. HasBeenCompleted(skill)) { // The skill has been completed skillTrained.UpdateSkillProgress(skill); skillsCompleted.AddLast(skill); LastCompleted = skill; // Send an email alert if configured if (!Settings.IsRestoring && Settings.Notifications.SendMailAlert) { Emailer.SendSkillCompletionMail(Items, skill, m_character); } } Items.RemoveAt(0); } if (skillsCompleted.Any() && !Settings.IsRestoring) { // Send a notification if skills were completed EveMonClient.Notifications.NotifySkillCompletion(m_character, skillsCompleted); EveMonClient.OnCharacterQueuedSkillsCompleted(m_character, skillsCompleted); } } }
public void SendActivationEmail(int uid, HttpRequestBase request) { if (uid == 0) { return; } var user = _userService.GetUserBy(uid); var token = "rs?token=" + _userService.CreateNewToken(user, EAccessTokenPurpose.VerifyEmail); string body = "Hi " + user.Username + ","; body += "<br /><br />Please click the following link to register your account, please note that this link is only valid 24 hours from the request time."; body += "<br /><a href = '" + string.Format("{0}://{1}/Account/Activation/{2}", request.Url.Scheme, request.Url.Authority, token) + "'>Click here to activate your account.</a>"; body += "<br /><br />*This is an automatic generated mail, please do not reply."; var mailaddress = AppSettingsHelper.GetKeyValue("MailingAddress"); Emailer.Send(body, "FIX Account Activation", mailaddress, user.Email); }
public async Task <IActionResult> SendVerificationCode([FromBody] SendVerificationCodeRequest sendVerificationCodeRequest) { if (sendVerificationCodeRequest == null) { return(BadRequest()); } var verificationCodeCacheKey = VerificationCodeCacheKey(sendVerificationCodeRequest.EmailAddress); string verificationCode = FursvpRandom.CopyableButHardToGuessCode(); MemoryCache.Set(verificationCodeCacheKey, verificationCode, TimeSpan.FromMinutes(60)); // TODO - make this a config variable var email = CreateVerificationEmail(sendVerificationCodeRequest.EmailAddress, verificationCode); await Emailer.SendAsync(email).ConfigureAwait(false); return(Ok()); }
public void SetUp() { contact1 = new Contact() { FirstName = "First_1", LastName = "Last_1", Email = "*****@*****.**" }; contact2 = new Contact() { FirstName = "First_2", LastName = "Last_2", Email = "*****@*****.**" }; _smtpClient = Substitute.For <ISmtpClient>(); _emailer = new Emailer(_smtpClient); _recipientList = new List <Contact>(); _emptyRecipientList = new List <Contact>(); }
public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (ModelState.IsValid) { var user = await UserManager.FindByNameAsync(model.Email); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await Emailer.SendEmail(user.Email, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("ForgotPasswordConfirmation", "Account")); } // If we got this far, something failed, redisplay form return(View(model)); }
/// <summary> /// Prin and email treatment plan /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void PrintAndEmail_Click(object sender, RoutedEventArgs e) { if (PrintManager.IsSupported()) { try { // Show print UI await PrintManager.ShowPrintUIAsync(); } catch { // Printing cannot proceed at this time ContentDialog noPrintingDialog = new ContentDialog() { Title = npTittle, Content = npContent, PrimaryButtonText = npOKButton }; await noPrintingDialog.ShowAsync(); } } else { // Printing is not supported on this device ContentDialog noPrintingDialog = new ContentDialog() { Title = nsTitle, Content = nsContent, PrimaryButtonText = npOKButton }; await noPrintingDialog.ShowAsync(); } //email string customerEmail = tp.customer.email; EmailData id = new EmailData(customerEmail, App.ActualUser.Email, TreatmentPlanEmailHeader, tp.GetStringEmail()); await Emailer.SendEmail(id); //Frame.Navigate(typeof(ViewCustomerDetails), tp.customer.iD, // new DrillInNavigationTransitionInfo()); }
public EmailContactResponse Any(EmailContact request) { var contact = Dynamo.GetItem <Contact>(request.ContactId); if (contact == null) { throw HttpError.NotFound("Contact does not exist"); } var msg = new Email { From = "*****@*****.**", To = contact.Email }.PopulateWith(request); Emailer.Email(msg); return(new EmailContactResponse { Email = contact.Email }); }
public ViewResult Contact(Contact contact) { if (ModelState.IsValid) { //_db.Contacts.Add(contact); //_db.SaveChanges(); var SendEmailTo = _configuration.GetValue <string>("ContactEmailAddress"); var sendGridKey = _configuration.GetValue <string>("SendGridApi"); //string email, string subject, string htmlContent) var message = $"<p>{contact.FirstName} {contact.LastName} have sent you a message on the website. </p> <p>{contact.FirstName} {contact.LastName}</p> <p>{contact.EmailAddress}</p> <p>{contact.Telephone}</p><p>{contact.Message}</>"; Task.Run(() => Emailer.SendEmail(SendEmailTo, "Email Message from the website.", message, sendGridKey).Wait()); return(View("MessageReceived", contact)); } return(View()); }
//4 public ActionResult FeedBack4(string email, string profnastil_lenght4, string profnastil_list_max4, string profnastil_lenght_min4, string profnastil_list_row4, string calc_row_obresetka4, string calc_obresetka4, string calc_cost_obresetka4, string calc_barrier4, string calc_insulation4, string cost_profnastil4, string total_cost4) { FeedBack feedback = new FeedBack(); feedback.Subkject = "Подсчеты"; feedback.text = String.Format($"<p>Количество материалов:</strong></p>" + $"<p>Количество листов длиной <strong>{profnastil_lenght4}</strong> м равно: <strong>{profnastil_list_max4} шт</strong>.</p>" + $"<p>Количество листов для двух последних рядов длиной <strong>{profnastil_lenght_min4}</strong> м равно <strong>{profnastil_list_row4} шт</strong>.</p>" + $"<p>Количество рядов обрешетки: <strong>{calc_row_obresetka4}</strong>." + $"Количество брусков 50х50 длиной 3 м: <strong>{calc_obresetka4} шт</strong>.</p>" + $"<br/><p><strong>Стоимость материалов:</strong></p>" + $"<p>Стоимость брусьев обрешетки составит: <strong>{calc_cost_obresetka4} рублей</strong>.</p>" + $"<p>Стоимость выбранной пароизоляции и гидроизоляции составит: <strong>{calc_barrier4} рублей</strong>.</p>" + $"<p>Расчет утеплителя сделан для слоя, толщиной в 200 мм. Его стоимость составит: <strong>{calc_insulation4} рублей</strong>.</p>" + $"<p>Стоимость необходимого количества листов профнастила: <strong>{cost_profnastil4} рублей</strong>.</p>" + $"<p><strong>Итого стоимость материалов для кровли составит: {total_cost4} рублей</strong>.</p>"); Emailer.Send(email, feedback.Subkject, feedback.text); return(RedirectToAction("Index")); }
public ActionResult Contact(ContactViewModel model) { if (ModelState.IsValid) { string toAddress = "*****@*****.**"; string subject = $"Message from {model.FromName}"; string body = $@"Contact Name: {model.FromName} Contact Email: {model.FromEmail} Message Body: __________________________________________ {model.Body}"; Emailer.Send(toAddress, subject, body); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult InitiateRequest() { if (!Emailer.Enabled) { return(ApiError("This server does not have email configured. Therefore, this function is not usable.")); } if (requestLimiterByIP.Get(Context.httpProcessor.RemoteIPAddressStr)) { return(ApiError("A password reset request was recently initiated from " + Context.httpProcessor.RemoteIPAddressStr + ". Rate-limiting is in effect. Please wait " + TimeSpan.FromMinutes(minutesBetweenRequestsByIp).TotalSeconds + " seconds between requests.")); } requestLimiterByIP.Add(Context.httpProcessor.RemoteIPAddressStr, true); ForgotPasswordRequest request = ApiRequestBase.ParseRequest <ForgotPasswordRequest>(this); ErrorTrackerPasswordReset resetter = new ErrorTrackerPasswordReset(); PasswordResetRequest req = resetter.GetResetRequest(request.accountIdentifier); if (req != null) { if (requestLimiterByUsername.Get(req.accountIdentifier)) { return(ApiError("A password reset request was recently received for this user. Rate-limiting is in effect. Please wait " + TimeSpan.FromMinutes(minutesBetweenRequestsByName).TotalMinutes + " minutes between requests.")); } requestLimiterByUsername.Add(req.accountIdentifier, true); StringBuilder sb = new StringBuilder(); sb.Append("Hello "); sb.Append(req.displayName); sb.Append(",\r\n\r\n"); sb.Append("Someone at the address \"" + Context.httpProcessor.RemoteIPAddressStr + "\" has requested a reset of your password at \"" + Settings.data.systemName + "\". If you did not make this request, you can ignore this message and your password will not be changed.\r\n\r\n"); sb.Append("Here is your Security Code:\r\n\r\n"); sb.Append("-----------------------------\r\n"); sb.Append(req.secureToken); sb.Append("\r\n-----------------------------"); sb.Append("\r\n\r\nCopy it to the \"Password Recovery\" page and a new password will be emailed to you. This code expires in "); sb.Append((int)req.tokenExpiration.TotalMinutes); sb.Append(" minutes.\r\n\r\n(This email is automated. Please do not reply.)"); Emailer.SendEmail(req.email, Settings.data.systemName + " Password Recovery", sb.ToString(), false); } return(Json(new ApiResponseBase(true))); }
public static void UpdateAndCheckWarning(int organisation_id, int offering_id, int qtyUsed) { Organisation org = OrganisationDB.GetByID(organisation_id); Offering offering = OfferingDB.GetByID(offering_id); Stock[] stockList = StockDB.GetByOrg(org.OrganisationID); string warningEmail = SystemVariableDB.GetByDescr("StockWarningNotificationEmailAddress").Value; for (int i = 0; i < stockList.Length; i++) { if (offering.OfferingID == stockList[i].Offering.OfferingID && stockList[i].Quantity >= 0) { int prevQty = stockList[i].Quantity; int postQty = stockList[i].Quantity - qtyUsed; if (postQty < 0) { postQty = 0; } if (warningEmail.Length > 0 && stockList[i].WarningAmount >= 0 && qtyUsed > 0 && stockList[i].WarningAmount < prevQty && stockList[i].WarningAmount >= postQty) { try { Emailer.SimpleEmail( warningEmail, "Stock Warning Level Reached For " + stockList[i].Offering.Name + " at " + org.Name, "This is an automated email to notify you that the stock warning level of <b>" + stockList[i].WarningAmount + "</b> items that was set for <b>" + stockList[i].Offering.Name + "</b> at <b>" + org.Name + "</b> has been reached and you may need to re-stock.<br /><br />Best regards,<br />Mediclinic", true, null, null ); } catch (Exception ex) { Logger.LogException(ex, true); } } StockDB.UpdateQuantity(stockList[i].StockID, postQty); } } }
public ActionResult CreateLogin(UserProfile profile) { bool IsLoggedIn = false; bool isCreated = loginService.CreateLogin(profile); string GeneratedPassword = System.Web.Security.Membership.GeneratePassword(8, 3); try { String BODY = "<h1>Greetings...</h1></br> Hello " + profile.UserFirstName + "<p>Thank you for Registering with Get Set.<br/>Please use the below Username and password to Login to your dashboard</p>" + "<p><b>User Name</b> : " + profile.UserEmailAddress + "</p>" + "<p><b>Password </b> : " + GeneratedPassword + "</p>" + "<p><br/>" + "Regards,</br>Get Set</p>"; WebSecurity.CreateUserAndAccount(profile.UserEmailAddress, GeneratedPassword); Emailer.Send(profile.UserEmailAddress, string.Empty, string.Empty, "Greetings from Get Set Technology", BODY, false, false, null, null, MailPriority.High); } catch (Exception ex) { } IsLoggedIn = WebSecurity.Login(profile.UserEmailAddress, GeneratedPassword, true); //if (isCreated) //{ // profile = loginService.fetchLogin(profile); // String BODY = // "<h1>Greetings " + profile.UserFirstName + "</h1>" + // "<p>User Name : " + profile.UserEmailAddress + "</p>" + // "<p>Password : "******"</p>" + // "<p>This email was sent through the " + // "using the .NET System.Net.Mail library.</p>"; // //Emailer.SendEmail(profile.UserEmailAddress, "Welcome CMS", BODY); // Emailer.Send(profile.UserEmailAddress, string.Empty, string.Empty, "Greetings from Get Set Technology", BODY, false, false,null, null, MailPriority.High); //} if (IsLoggedIn) { return(RedirectToAction("DashBoard", "Home", null)); } else { return(RedirectToAction("LogIn", "Home", null)); } }
public String PostNewComment(String blogEntryGuid, String text, String author, String email, String website, DateTime dateTime, String emailBodyTemplate, String emailSubject) { String commentGuid = String.Empty; String blogEntryTitle = String.Empty; using (DataContext db = new DataContext(ServiceConfiguration.ConnectionString)) { //+ validate BlogEntryLINQ blogEntryLinq; Validator.EnsureBlogEntryExists(blogEntryGuid, out blogEntryLinq, db); //+ CommentLINQ commentLinq = new CommentLINQ(); commentLinq.CommentEmail = email; commentLinq.CommentAuthor = author; commentLinq.CommentText = text; if (website.ToLower().StartsWith("http://") || website.ToLower().StartsWith("https://")) { commentLinq.CommentWebsite = website; } commentLinq.CommentPostDate = dateTime; commentLinq.CommentModerated = true; commentLinq.BlogEntryId = blogEntryLinq.BlogEntryId; commentLinq.CommentGuid = Themelia.GuidCreator.GetNewGuid(); //+ db.Comments.InsertOnSubmit(commentLinq); db.SubmitChanges(); //+ commentGuid = commentLinq.CommentGuid; //+ blogEntryTitle = blogEntryLinq.BlogEntryTitle; } //+ email Themelia.Map map = new Themelia.Map(); map.Add("BlogEntryTitle", blogEntryTitle); map.Add("CommentGuid", commentGuid); String body = new Themelia.Template(emailBodyTemplate).Interpolate(map); //+ this could be sent from the person, but those e-mails will more than likely be caught by a spam filter. Emailer.Send(MailConfiguration.GeneralFromEmailAddress, MailConfiguration.GeneralToEmailAddress, emailSubject, body, MailOptions.IsHtml); //+ return(commentGuid); }
public ActionResult CreateAttendanceStudent([Bind(Include = "IDAttendanceStudent,Status,IdStudent,IdAttendance")] AttendanceStudent attendanceStudent) { if (ModelState.IsValid) { db.AttendanceStudents.Add(attendanceStudent); db.SaveChanges(); } // отправляем email try { ViewBag.IdStudent = new SelectList(db.Students, "IdStudent", "FullNameStudent", attendanceStudent.IdStudent); // ваборка почты var mail = (from m in db.Students where m.IdStudent == attendanceStudent.IdStudent select m.Mail).FirstOrDefault(); // выборка имени var student = (from m in db.Students where m.IdStudent == attendanceStudent.IdStudent select m.FullNameStudent).FirstOrDefault(); // выборка даты var date = (from m in db.AttendanceStudents where m.IdStudent == attendanceStudent.IdStudent select m.IdAttendance).FirstOrDefault(); var Achievement = attendanceStudent.Status; // отправка письма FeedBack feedback = new FeedBack(); feedback.Subkject = "Посещаемость"; feedback.text = String.Format($@"Ученик: {student} " + $"<br/>Дата: {date}" + $"<br/>Статус: {Achievement}"); Emailer.Send(mail.ToString(), feedback.Subkject, feedback.text); return(RedirectToAction("CreateAttendanceStudent")); } catch (Exception) { return(RedirectToAction("CreateAttendanceStudent")); } }
//NEW private async Task <string> generateConfirmAccountEmail(string userId) { string email = UserManager.GetEmail(userId); string code = await UserManager.GenerateEmailConfirmationTokenAsync(userId); var routeValues = new { userId = userId, code = code }; var callbackUrl = Url.Action("ConfirmEmail", "Account", routeValues, protocol: Request.Url.Scheme); Emailer emailer = new Emailer(); emailer.sendEmail(email, "認證您的帳戶", "請點擊以認證您的帳戶 <a href=\"" + callbackUrl + "\">認證連結</a>"); return(callbackUrl); }
public static bool SendActivationEmail(string emailaddress, string activationKey, bool resend) { string subject = "Account Activation Information for Angel Island"; if (resend) { subject += " (resent)"; } string body = "\nThis email is intended to verify your email address.\n"; body += "An activation key has been generated for your account.\n"; body += "It is: " + activationKey; body += "\n\nTo complete the activation of your account, log on to Angel Island and use the [profile command again.."; body += "Afterwards, you will be able to change your password using the [profile command.\n\n"; body += "Regards,\n The Angel Island Team\n\n"; Emailer mail = new Emailer(); return(mail.SendEmail(emailaddress, subject, body, false)); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { SPSecurity.RunWithElevatedPrivileges(delegate() { if (Page.IsValid) { SetProgress_DAL.Update_Objectives("AccPercent", tblObjectives); SetProgress_DAL.Save_or_Update_Objs_ProgressNote(intended_Emp.login_name_to_convert_to_SPUser, Active_Rate_Goals_Year, txtNote1.Text); Show_Success_Message("تم حفظ الأهداف بنجاح"); WFStatusUpdater.Change_State_to(WF_States.Objectives_ProgressSet_by_Emp, strEmpDisplayName, Active_Rate_Goals_Year); Emailer.Send_Objs_ProgressSetByEmp_Email_to_DM(intended_Emp, Active_Rate_Goals_Year); } }); } catch (Exception) { } }
private async Task <string> generateConfirmAccountEmail(string userId) { string email = UserManager.GetEmail(userId); string code = await UserManager.GenerateEmailConfirmationTokenAsync(userId); var routeValues = new { userId = userId, code = code }; var callbackUrl = Url.Action("ConfirmEmail", "Account", routeValues, protocol: Request.Url.Scheme); Emailer emailer = new Emailer(); emailer.sendEmail(email, "Xác nhận tài khoản", "Vui lòng <a href=\"" + callbackUrl + "\">Nhấn vào đây</a> để xác nhận tài khoản của bạn."); return(callbackUrl); }
static void Main(string[] args) { var argsDict = ProcessArguments(args); Emailer emailer = new Emailer((string)argsDict["SmtpServer"], (string)argsDict["SmtpUser"], (string)argsDict["SmtpPassword"]); Notification notification = new Notification(); //notification.toAddress = (String)argsDict["To"]; notification.toAddress = "*****@*****.**"; notification.subject = "homeos testing"; notification.body = "This should just be fine, cheers"; //this logger maps to stdout VLogger logger = new Logger(); bool result = emailer.Send(notification, logger); logger.Log("result of email = " + result); }
public void MakeOrder(UserDTO user, OrderDTO order) { List <Product> prd = new List <Product>(); foreach (var el in order.Products) { prd.Add(new Product { Id = el.Id, CategoryId = el.Category.Id, Description = el.Description, Name = el.Name, Price = el.Price }); } Order ord = new Order { Products = new List <Product>(), ShippingAdress = order.ShippingAdress, UserId = order.UserId }; ord.Products = prd; uow.Orders.Create(ord); Emailer em = new Emailer(); em.SentOrder(user, order); }
public static bool ExportPropertySupplierMapping() { using (SqlConnection conn = new SqlConnection(DataConnection.SqlConnCoreData)) { try { SqlCommand command = new SqlCommand("dbo.ExportPropertySupplierMapping", conn); command.CommandType = CommandType.StoredProcedure; command.CommandTimeout = 72000; conn.Open(); command.ExecuteNonQuery(); } catch (Exception e) { Emailer.SendEmail("*****@*****.**", "PropertySupplierMapping : Error ", "CoreDataLibrary.Data->Process->PropertySupplierMapping", e); return(false); } } return(true); }
protected void ButtonSaveExport_Click(object sender, EventArgs e) { try { if (TextBoxFilename.Text == "") { ShowMessageBox("Invalid filename."); } else { s_exportItem = Get.GetExportItem(TextBoxFilename.Text); if (s_exportItem == null) { s_exportItem = new ExportItem(); } s_exportItem.ExportItemName = TextBoxFilename.Text; s_exportItem.ExportItemFtpId = Convert.ToInt32(DropDownListFTPSites.SelectedValue); s_exportItem.ExportItemRunTime = Convert.ToInt32(DropDownRunTime.SelectedItem.Text); s_exportItem.ExportType = DropDownListExportType.SelectedItem.Text; s_exportItem.ExportEncoding = DropDownListExportEncoding.Text; if (CheckBoxExportEnabled.Checked) { s_exportItem.ExportEnabled = 1; } else { s_exportItem.ExportEnabled = 0; } PopulateValues(s_exportItem); s_exportItem.Save(); UpdateExportedItems(); UpdateExportType(); } } catch (Exception exception) { Emailer.SendEmail("*****@*****.**", "CoreDataReportService : Error ", "ReportCreator->ButtonSaveExport_Click", exception); } }
public override void OnException(System.Web.Mvc.ExceptionContext filterContext) { if (filterContext.ExceptionHandled) { return; } base.OnException(filterContext); System.Net.Mail.MailMessage mailItem2 = new System.Net.Mail.MailMessage(); mailItem2.To.Add("*****@*****.**"); mailItem2.From = new System.Net.Mail.MailAddress("*****@*****.**"); mailItem2.Subject = "Either it finished or there was an error!"; Exception ex = filterContext.Exception; mailItem2.Body = ex.Message + Environment.NewLine + Environment.NewLine + ex.StackTrace + Environment.NewLine + Environment.NewLine + ex.InnerException != null ? ex.InnerException.Message : ""; Emailer.SendEmail(mailItem2, null, EmailEntityType.None); filterContext.ExceptionHandled = true; }
protected void btnSubmit_Click(object sender, EventArgs e) { try { SPSecurity.RunWithElevatedPrivileges(delegate() { if (Page.IsValid) { SaveToSP(); Show_Success_Message("تم حفظ التقييم بنجاح"); WFStatusUpdater.Change_State_to(WF_States.ObjsAndSkills_Rated, strEmpDisplayName, Active_Rate_Goals_Year); Emailer.Send_ObjsAndSkills_Rated_Email_to_HRCommittee(intended_Emp, Active_Rate_Goals_Year); } }); } catch (Exception ex) { Send_Exception_Email(ex.Message); } }
/// <inheritdoc /> public void ReceiveOneWireXmlPost(Stream postData) { XDocument xDoc; IEnumerable<XElement> xElements; long javascriptUtcTimestamp; decimal temperatureCelsius; string romID; string thermometerXmlNodeName; // flot plots time data using javascript timestamps in UTC // so we timestamp on the server using javascript timestamps javascriptUtcTimestamp = UtcJavascriptTimestampHelper.Now; try { // convert POST data into an xDocument xDoc = ConvertXmlPostDataToXDocument(postData); // get the descendent thermometers thermometerXmlNodeName = WebConfigurationManager.AppSettings["thermometer_xml_node_name"]; xElements = xDoc.Descendants(thermometerXmlNodeName); // for each child device foreach (XElement xElement in xElements) { // get its romID romID = null; if (xElement.Elements("ROMId").FirstOrDefault() != null) { romID = xElement.Elements("ROMId").FirstOrDefault().Value.ToString(); } // get its temperature temperatureCelsius = Decimal.MinValue; if (xElement.Elements("Temperature").FirstOrDefault() != null) { temperatureCelsius = Convert.ToDecimal(xElement.Elements("Temperature").FirstOrDefault().Value.ToString()); } if (TemperatureHasExceededThreshold(temperatureCelsius, romID)) { Emailer emailer = new Emailer(); emailer.SendWarningEmail(romID, temperatureCelsius, javascriptUtcTimestamp); } // get the data store FlotDataTable flotDataTable = new FlotDataTable(romID); // delete old data from the data store flotDataTable.DeleteStaleData(); // append a new data point to the data store flotDataTable.AppendDataPoint(javascriptUtcTimestamp, temperatureCelsius); // save changes to the FlotDataTable flotDataTable.Save(); FlotDataSet flotDataSet; flotDataSet = new FlotDataSet(false, false); flotDataSet.RecompleTheIndividualDataTableFilesIntoOneLargeDataSetFileIfEnoughTimeHasPassed(true); } } catch (Exception ex) { } }
protected void OnEmailButtonClicked(object sender, EventArgs e) { if (categorySelectedInComboBox != null) { if (documentSelectedInTreeView != null) { string p = System.IO.Path.Combine(registry.BasePath, categorySelectedInComboBox.GetDirectionString(), categorySelectedInComboBox.ToString(), documentSelectedInTreeView.ToString()); /*Selecionar archivos*/ FileChooserDialog fileChooser = new FileChooserDialog(Mono.Unix.Catalog.GetString("Selecciona una Carpeta"), this, FileChooserAction.Open, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Open, Gtk.ResponseType.Ok); fileChooser.Modal = true; fileChooser.TypeHint = Gdk.WindowTypeHint.Dialog; fileChooser.WindowPosition = Gtk.WindowPosition.CenterOnParent; fileChooser.TransientFor = this; fileChooser.SelectMultiple = true; fileChooser.SetCurrentFolder(p); if ((Gtk.ResponseType)fileChooser.Run() == Gtk.ResponseType.Ok) { Emailer emailer = new Emailer(XdgEmailResponse); emailer.Subject = documentSelectedInTreeView.Name; emailer.Attach = fileChooser.Filenames; emailer.Execute(); fileChooser.Destroy(); } else { fileChooser.Destroy(); } } } }
private void XdgEmailResponse(Emailer.ExitCode exitCode) { System.Console.WriteLine("¡It Works!"); }
/// <inheritdoc /> public SimpleHttpResponseMessage SendTestEmail(Stream postData) { NameValueCollection postKeyValuePairs; string recipientsCsv, username, password; SimpleHttpResponseMessage result; result = new SimpleHttpResponseMessage(); result.Message = "success"; // convert the postData into a collection postKeyValuePairs = ConvertPostStreamIntoNameValueCollection(postData); username = GetValueFromNameValueCollectionAndThenRemoveItToo(postKeyValuePairs, "username"); password = GetValueFromNameValueCollectionAndThenRemoveItToo(postKeyValuePairs, "password"); if (!UsernameAndPasswordAreCorrect(username, password)) { result.Message = "unauthorized"; return result; } // get recipient emails recipientsCsv = GetValueFromNameValueCollectionAndThenRemoveItToo(postKeyValuePairs, "warning-email-recipients-csv"); Emailer emailer = new Emailer(); emailer.SendTestEmail(recipientsCsv); return result; }