public void SendMails(MailDelegate success, MailDelegate error) { if (true) { success(); } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { if (ValidateData()) { SetProperties(); int userID = objUserRegistration.ExecuteProcedure("INSERT", 0,"Signup"); if (ddlUserType.SelectedValue == "4")// && ddlUserCategory.SelectedValue == "4") { SetPropertiesCustomer_IL(userID); objLeads.SaveCustomerData("INSERT"); } if (txtEmail.Text.Trim() != "") { { string strMessage = "Dear Subscriber,<br> Your registration is comfirmed.<br> Your User Name :" + txtUserName.Text.Trim() + ". <br> Password :"******""; string strSubject = "Registration Confirmation mail"; if (txtEmail.Text.Trim() != "") { MailDelegate mailDelegate = new MailDelegate(csGlobalFunction.SendHTMLEmail); mailDelegate.BeginInvoke(txtEmail.Text.Trim(), strSubject, txtUserName.Text.Trim(), txtPwd.Text.Trim(), null, null); //csGlobalFunction.SendEmail(recipientemailto, strSubject, strMessage); } } } ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('You are sign-up successfully and your user id and password will be send to your mail id with in 2-5 minutes.');", true); ClearControl(); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", strFnc, true); } } catch (Exception ex) { string strFnc = ""; strFnc = ex.Message; ScriptManager.RegisterStartupScript(this, this.GetType(), "CatchMsg", "javascript:AlertMsg('" + strFnc + "');", true); } }
private void SendEmail(object obj) { MailMessage mail = new MailMessage("*****@*****.**", receiverTextBox.Text); SmtpClient client = new SmtpClient(); client.Port = 25; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Host = "smtp.mail.ru"; mail.Subject = themeTextBox.Text; mail.Body = mailTextBox.Text; MailDelegate mailDelegate = client.Send; try { mailDelegate.BeginInvoke(mail, null, null); } catch (SmtpFailedRecipientsException exception) { _notifyIcon.BalloonTipTitle = "Ошибка"; _notifyIcon.BalloonTipText = exception.Message; _notifyIcon.ShowBalloonTip(2000); } catch (SmtpException exception) { _notifyIcon.BalloonTipTitle = "Ошибка"; _notifyIcon.BalloonTipText = exception.Message; _notifyIcon.ShowBalloonTip(2000); } catch (Exception exception) { _notifyIcon.BalloonTipTitle = "Ошибка"; _notifyIcon.BalloonTipText = exception.Message; _notifyIcon.ShowBalloonTip(2000); } }