当前位置: 首页>>代码示例>>C#>>正文


C# Email.SendEmail方法代码示例

本文整理汇总了C#中Email.SendEmail方法的典型用法代码示例。如果您正苦于以下问题:C# Email.SendEmail方法的具体用法?C# Email.SendEmail怎么用?C# Email.SendEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Email的用法示例。


在下文中一共展示了Email.SendEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendMail

        private void SendMail(string option)
        {
            string body = Utility.GetEmailTemplate("/IPPP/Template/youroptions.htm");
            body = string.Format(body, User.Identity.Name, option);

            Email objEmail = new Email();
            objEmail.EmailBody = body;
            objEmail.EmailSubject = Utility.GetAppSettingValue("IPPP_Options_Email_Subject");
            objEmail.EmailTo = Utility.GetAppSettingValue("IPPP_Options_Recipient_Email");
            objEmail.SendEmail();
        }
开发者ID:ThomasJRichardson,项目名称:APT2012,代码行数:11,代码来源:youroptions.aspx.cs

示例2: SendEmails_Click

    protected void SendEmails_Click(object sender, EventArgs e)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (EmailBody.Text.Length == 0)
        {
            Message.Text = "The email body has no text";
            return;
        }
        if (EmailSubject.Text.Length == 0)
        {
            Message.Text = "The email subject has no text";
            return;
        }
        string type = EmailType.SelectedValue;
        string sql = "";
        DB db = new DB();
        DataRow[] rows = null;
        if (type == "Production Customers")
        {
            sql = "SELECT username,email FROM customers WHERE status='active'";
            rows = db.ViziAppsExecuteSql(State, sql);
        }
        else
        {
            sql = "SELECT username,email FROM customers WHERE status!='inactive'";
            rows = db.ViziAppsExecuteSql(State, sql);
        }
        StringBuilder no_emails = new StringBuilder();
        StringBuilder sent_users = new StringBuilder();
        Email email = new Email();
        foreach (DataRow row in rows)
        {
            string username = row["username"].ToString();
            string to_email = row["email"].ToString();
            if (to_email.Length > 0)
            {
                email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(), to_email, "", "", EmailSubject.Text, EmailBody.Text, "",false);
                sent_users.Append(username + "\n");
            }
            else if(username!="admin" && username != "prompts")
            {
                no_emails.Append(username + "; ");
            }
        }
        if (no_emails.Length > 0)
        {
            Message.Text = "The emails were sent successfully, except for the following users: " + no_emails.ToString();
        }
        else
            Message.Text = "The emails were all sent successfully.";

        SentUsers.Text = sent_users.ToString();
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:53,代码来源:AdminEmail.aspx.cs

示例3: Mail

        /// <summary>
        /// This method encapsulates the email function.
        /// </summary>
        /// <param name="emailTo"></param>
        /// <param name="emailFrom"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="isHtml"></param>
        private void Mail(string emailTo, string emailFrom, string subject, string body, bool isHtml)
        {
            Email email = new Email();
            email.ToList = emailTo;
            email.FromEmail = emailFrom;
            email.Subject = subject;
            email.MessageBody = body;
            email.isHTML = isHtml;

            email.SendEmail(email);
        }
开发者ID:kimimhd,项目名称:Security-Guard,代码行数:19,代码来源:SGAccountController.cs

示例4: UpdateProfile_Click

    protected void UpdateProfile_Click(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        Message.Text = "";

        PasswordTextBox.Text = Request.Form.Get("PasswordTextBox");
        ConfirmPasswordBox.Text = Request.Form.Get("ConfirmPasswordBox");
        CompanyTextBox.Text = Request.Form.Get("CompanyTextBox");
        RoleTextBox.Text = Request.Form.Get("RoleTextBox");
        FirstNameTextBox.Text = Request.Form.Get("FirstNameTextBox");
        LastNameTextBox.Text = Request.Form.Get("LastNameTextBox");
        StreetTextBox.Text = Request.Form.Get("StreetTextBox");
        CityTextBox.Text = Request.Form.Get("CityTextBox");
        StateList.Text = Request.Form.Get("StateList");
        PostalCodeTextBox.Text = Request.Form.Get("PostalCodeTextBox");
        CountryTextBox.Text = Request.Form.Get("CountryTextBox");
        PhoneTextbox.Text = Request.Form.Get("PhoneTextbox");
        EmailTextBox.Text = Request.Form.Get("EmailTextBox");
        string force_1_user_sessions = Request.Form.Get("Force1UserSessions");
        Force1UserSessions.Checked = force_1_user_sessions == "on" ? true : false;

        //validation
        if (CompanyTextBox.Text.Length > 0 && !Check.ValidateName(Message, CompanyTextBox.Text))
        {
            return;
        }
        if (RoleTextBox.Text.Length > 0 && !Check.ValidateString(Message, RoleTextBox.Text))
        {
            return;
        }
        if (FirstNameTextBox.Text.Length > 0 && !Check.ValidateName(Message, FirstNameTextBox.Text))
        {
            return;
        }
        if (LastNameTextBox.Text.Length > 0 && !Check.ValidateName(Message, LastNameTextBox.Text))
        {
            return;
        }
        if (StreetTextBox.Text.Length > 0 && !Check.ValidateText(Message, StreetTextBox.Text))
        {
            return;
        }
        if (CityTextBox.Text.Length > 0 && !Check.ValidateName(Message, CityTextBox.Text))
        {
            return;
        }
        if (PostalCodeTextBox.Text.Length > 0 && !Check.ValidateZipcode(Message, PostalCodeTextBox.Text))
        {
            return;
        }
        if (CountryTextBox.Text.Length > 0 && !Check.ValidateName(Message, CountryTextBox.Text))
        {
            return;
        }
        if (!Check.ValidatePhone(Message, PhoneTextbox.Text))
        {
            return;
        }
        if (!Check.ValidateEmail(Message, EmailTextBox.Text))
        {
            return;
        }

        StringBuilder sql = null;
        DB db = new DB();
        string username = null;
        if (State["Username"].ToString() != "admin")
        {
            username =  State["Username"].ToString();
        }
        else
        {
            username =  State["ServerAdminUsername"].ToString();
        }

        if (PasswordTextBox.Text.Length > 0 || ConfirmPasswordBox.Text.Length > 0)
        {
            if (PasswordTextBox.Text == ConfirmPasswordBox.Text)
            {
                if (!Check.ValidatePassword(Message, PasswordTextBox.Text))
                {
                    return;
                }
                sql = new StringBuilder("UPDATE customers SET password='" + util.MySqlFilter(PasswordTextBox.Text) + "'");
                sql.Append(" WHERE username='" + username + "'");
                db.ViziAppsExecuteNonQuery(State, sql.ToString());

                sql = new StringBuilder("SELECT email from customers WHERE username='" + username + "'");
                string to_email = db.ViziAppsExecuteScalar(State, sql.ToString());

                Email email = new Email();
                StringBuilder body = new StringBuilder("\nYour ViziApps password has been changed.\n\n");

                body.Append("If you did not change it, contact our support team at [email protected] right away. ");
                body.Append("\n\n - The ViziApps Team \n");

                email.SendEmail(State,   HttpRuntime.Cache["TechSupportEmail"].ToString(), to_email, "", "", "ViziApps Notice", body.ToString(), "",false);
//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:TabMyProfile.aspx.cs

示例5: CG_CreateFreeCustomerAndInvoices


//.........这里部分代码省略.........

                return false;
            }

            //SUCCESS
            if (String.IsNullOrEmpty(returnCustomer.Code) == false)
            {
                AppCGCustomerCode = returnCustomer.Code;
            }

            // IF SUCCESSFULLY ABLE TO CREATE THE FREE NATIVE CUSTOMER THEN KICK OFF A ONE TIME INVOICE FOR BRANDING

            OneTimeInvoicePost myonetimeinvoice = new OneTimeInvoicePost();

            myonetimeinvoice.InvoiceCharges = new CustomChargePost[1];

            int number_of_charges = 0;
            CustomChargePost mycustom1 = new CustomChargePost();

            mycustom1.CustomerCode = AppCGCustomerCode;
            mycustom1.Description = "Branding";
            mycustom1.ChargeCode = "BRANDING ";
            mycustom1.EachAmount = 0;
            mycustom1.Quantity = 0;

            if ((State["SelectedDeviceType"].ToString() == Constants.ANDROID_PHONE || State["SelectedDeviceType"].ToString() == Constants.ANDROID_TABLET) && (String.IsNullOrEmpty(AppCGCustomerCode) == false))
            {
                mycustom1.ChargeCode += "- ANRDOID";
                mycustom1.CustomerCode = AppCGCustomerCode;
                mycustom1.Quantity = 1;
                mycustom1.EachAmount += 99;
                mycustom1.Description += "- Android";
            }

            if ((State["SelectedDeviceType"].ToString() == Constants.IPHONE || State["SelectedDeviceType"].ToString() == Constants.IPAD) && (String.IsNullOrEmpty(AppCGCustomerCode) == false))
            {
                mycustom1.ChargeCode += "- iOS";
                mycustom1.Quantity = 1;
                mycustom1.EachAmount += 99;
                mycustom1.Description += "- iOS";
            }

            myonetimeinvoice.InvoiceCharges[number_of_charges] = new CustomChargePost();
            myonetimeinvoice.InvoiceCharges[number_of_charges] = mycustom1;

            CGError servererror2 = new CGError();
            //SERVER CALL TO THE ONE TIME INVOICE for both charges at once.
            Customer returnCustomer2 = CheddarGetter.CreateOneTimeInvoice(myonetimeinvoice, servererror2);

            if (String.IsNullOrEmpty(servererror2.Code) == false)
            {
                //CG.InnerHtml += "<li>ERROR:" + servererror2.Message;

                SubmitButton.Enabled = true;
                SubmitButton.Text = "Submit";

                //string clickHandler = "this.disabled = false; this.value=\'Submit\'; ";
                //SubmitButton.Attributes.Add("onclick", clickHandler);

                RadNotification1.Title = "WARNING";
                RadNotification1.Text = servererror2.Message;
                RadNotification1.Visible = true;
                RadNotification1.Show();

                return false;
            }

            //Store in the PaidServicesDB
            BillingUtil billingutil = new BillingUtil();

            //Record the new SKU but do not turn on the 'paid' field as yet.

            string confirm = returnCustomer2.Subscriptions[0].Invoices[1].PaidTransactionId.ToString();

            string sku = returnCustomer2.Subscriptions[0].SubscriptionsPlans[0].Code.ToString();
            billingutil.StorePaidServicesDB(confirm,sku,State,false);

            //Enable 10 day grace for App store Approval.
            Util util = new Util();
            util.SetFreeProductionExpiration(State, DateTime.Now.ToUniversalTime().AddDays(10.0D));

            //Send Email to Support.
            System.Text.StringBuilder body = new System.Text.StringBuilder("Customer Username: " + State["Username"].ToString() + "\n");
            body.Append("App Name: " + State["SelectedApp"].ToString() + "\n");
            body.Append("\n-- ViziApps Support");
            Email email = new Email();
            string status = email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(),  HttpRuntime.Cache["TechSupportEmail"].ToString(),"", "", "Customer submitted App for App Store Preparation", body.ToString(), "", false);

            return true;

        }//end try

        catch (Exception ex)
        {
            System.Diagnostics.Debug.WriteLine(ex.Message.ToString() + ex.StackTrace.ToString());

        }

        return false;
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:AppBrandingBilling.aspx.cs

示例6: CreateAccountSubmit_ServerClick


//.........这里部分代码省略.........
        {
            err.Append(Error.Text.Clone() + "<BR>");
        }
        else
        {
            string query = "SELECT username FROM customers WHERE username='" + username + "'";
            string prev_username = db.ViziAppsExecuteScalar(State,query);
            if (username == prev_username)
            {
               /* query = "SELECT password FROM customers WHERE username='" + username + "'";
                string password = db.ViziAppsExecuteScalar(State, query);
                if(password != PasswordTextBox.Text)*/
                     err.Append("The " + username + " account already exists.<BR>");
            }
            if (address.Length> 0 && address.ToLower() != "[email protected]") //for every email not for testing
            {
                query = "SELECT email FROM customers WHERE email='" + address + "'";
                string email = db.ViziAppsExecuteScalar(State, query);
                if (email == this.EmailTextBox.Text)
                {
                    err.Append("An account already exists with the same email.<BR>");
                }
            }
        }
        if (!Check.ValidatePassword(Error, PasswordTextBox.Text))
        {
            err.Append("Enter Password: " +Error.Text.Clone() + "<BR>");
        }
        if (!Check.ValidateEmail(Error, EmailTextBox.Text))
        {
            err.Append(Error.Text.Clone() + "<BR>");
        }
        if (PasswordTextBox.Text != ConfirmPasswordBox.Text)
        {
            err.Append("The password and confirming password do not match. Try again.<BR>");
        }
        if (!Check.ValidateName(Error,FirstNameTextBox.Text))
        {
            err.Append("Enter First Name: " + Error.Text.Clone() + "<BR>");
        }
        if (!Check.ValidateName(Error, LastNameTextBox.Text))
        {
            err.Append("Enter Last Name: " + Error.Text.Clone() + "<BR>");
        }

        string phone = PhoneTextBox.Text.Trim ();
        if (PhoneTextBox.Text.Length > 0) //optional field
        {
            if (!Check.ValidatePhone(Error, PhoneTextBox.Text))
            {
                err.Append("Enter a valid phone number: " + Error.Text.Clone() + "<BR>");
            }
        }
        if (err.Length > 0)
        {
            MessageLabel.Text = "The following input(s) are required:<BR>" + err.ToString();
            db.CloseViziAppsDatabase(State);
            return;
        }
        try
        {

            string account_type = "type=viziapps;"; //set default for now
            string security_question = "";
            string security_answer = "";

            string customer_id = util.CreateMobiFlexAccount(State, username, PasswordTextBox.Text.Trim(), security_question, security_answer, FirstNameTextBox.Text.Trim(), LastNameTextBox.Text.Trim(),
                    EmailTextBox.Text.ToLower().Trim(), phone, account_type, ReferralSourceList.SelectedValue,AppToBuild.Text, "inactive");

            string email_template_path = Server.MapPath(".") + @"\templates\EmailValidation.txt";
            string url =   HttpRuntime.Cache["PublicViziAppsUrl"].ToString() + "/ValidateEmail.aspx?id=" + customer_id;
            string from =   HttpRuntime.Cache["TechSupportEmail"].ToString();
            string body = File.ReadAllText(email_template_path)
                    .Replace("[NAME]", FirstNameTextBox.Text.Trim())
                    .Replace("[LINK]",url)
                    .Replace("[SUPPORT]",from);

            Email email = new Email();
            string status = email.SendEmail(State, from, EmailTextBox.Text, "", "", "ViziApps Registration", body, "",true);
            if (status.IndexOf("OK") >= 0)
            {
                MessageLabel.Text = "An email has been sent to you to complete your registration. Please follow the directions in the email.";
            }
            else
            {
                MessageLabel.Text = status;
                //problem with email : delete account
                string sql = "DELETE FROM customers WHERE username='" + username + "'";
                db.ViziAppsExecuteNonQuery(State, sql);
            }
            db.CloseViziAppsDatabase(State);
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            MessageLabel.Text = ex.Message + ": " + ex.StackTrace;
            db.CloseViziAppsDatabase(State);
            return;
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:CreateAccount.aspx.cs

示例7: SendEmailToSalesandCustomer

    private void SendEmailToSalesandCustomer(DB db)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        //send an email with all the stuff
        string sql = "SELECT first_name, last_name, email, phone,referral_source,app_to_build,account_type,password FROM customers WHERE customer_id='" +  State["CustomerID"].ToString() + "'";
        DataRow[] rows = db.ViziAppsExecuteSql((Hashtable)HttpRuntime.Cache[Session.SessionID], sql);
        DataRow row = rows[0];
        string email_template_path = null;
        string body = null;

        string subject = null;
        if (!row["account_type"].ToString().Contains("google_apps"))
        {
            subject = "New Account Signup for ViziApps";
            email_template_path = Server.MapPath(".") + @"\templates\NewViziAppsSignupEmail.txt";
            body = File.ReadAllText(email_template_path)
                     .Replace("[USERNAME]", State["Username"].ToString())
                     .Replace("[FIRST_NAME]", row["first_name"].ToString())
                     .Replace("[LAST_NAME]", row["last_name"].ToString())
                     .Replace("[EMAIL]", row["email"].ToString());

            if (row["phone"] != null && row["phone"] != DBNull.Value && row["phone"].ToString().Length > 0)
                 body = body.Replace("[PHONE]", row["phone"].ToString());
            else
                body = body.Replace("[PHONE]", "Unknown");

            if (row["referral_source"] != null && row["referral_source"] != DBNull.Value && row["referral_source"].ToString() != "unknown")
                body = body.Replace("[FOUND_BY]", row["referral_source"].ToString());
            else
                body = body.Replace("[FOUND_BY]", "Unknown");

            if (row["app_to_build"] != null && row["app_to_build"] != DBNull.Value && row["app_to_build"].ToString().Length > 0)
                body = body.Replace("[APP_TO_BUILD]", row["app_to_build"].ToString());
            else
                body = body.Replace("[APP_TO_BUILD]", "Unknown");
        }
        else if (row["account_type"].ToString().Contains("google_apps"))
        {
            subject = "New Account Signup for ViziApps From Google Apps";
            email_template_path = Server.MapPath(".") + @"\templates\NewGoogleAppsViziAppsSignupEmail.txt";
            body = File.ReadAllText(email_template_path)
                    .Replace("[USERNAME]", State["Username"].ToString())
                    .Replace("[FIRST_NAME]", row["first_name"].ToString())
                    .Replace("[LAST_NAME]", row["last_name"].ToString())
                    .Replace("[EMAIL]", row["email"].ToString());
        }

        Email email = new Email();
        email.SendEmail((Hashtable)HttpRuntime.Cache[Session.SessionID],   HttpRuntime.Cache["TechSupportEmail"].ToString(),   HttpRuntime.Cache["SalesEmail"].ToString(), "", "", subject, body.ToString(), "",true);

        string welcome_body = null;
        if ( State["LoggedInFromGoogleApps"] != null)
        {
            email_template_path = Server.MapPath(".") + @"\templates\GoogleAppsCustomerWelcomeEmail.txt";
             State["LoggedInFromGoogleApps"] = "true";
            welcome_body = File.ReadAllText(email_template_path).Replace("[NAME]", row["first_name"].ToString()).Replace("[PASSWORD]", row["password"].ToString());
        }
        else
        {
            email_template_path = Server.MapPath(".") + @"\templates\CustomerWelcomeEmail.txt";
            welcome_body = File.ReadAllText(email_template_path).Replace("[NAME]", row["first_name"].ToString());
        }
        email.SendEmail((Hashtable)HttpRuntime.Cache[Session.SessionID],   HttpRuntime.Cache["SalesEmail"].ToString(), row["email"].ToString(), "", "", "Welcome to ViziApps", welcome_body, "",true);
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:65,代码来源:EULAAgreement.aspx.cs

示例8: EmailUpgradeNotice_Click

 protected void EmailUpgradeNotice_Click(object sender, EventArgs e)
 {
     Hashtable UsersList = (Hashtable)HttpRuntime.Cache["UsersList"];
     DB db = new DB();
     Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
     foreach (string username in UsersList.Keys)
     {
         string To = db.ViziAppsExecuteScalar(State, "SELECT email FROM customers WHERE username='" + username + "'");
         Email email = new Email();
         string From =   HttpRuntime.Cache["TechSupportEmail"].ToString();
         string Body = "The ViziApps Studio will be down in 1 minute for 5 minutes for an upgrade maintenance.\n\nSorry for the inconvenience.\n\n--ViziApps Support";
         string status = email.SendEmail(State, From, To, "", "", "ViziApps Studio Maintenance Notice", Body, "",false);
         if (status.IndexOf("OK") < 0)
         {
             Message.Text = "There was a problem sending the emails: " + status;
             db.CloseViziAppsDatabase(State);
             return;
         }
     }
     db.CloseViziAppsDatabase(State);
     Message.Text = "Maintenance notice has been emailed to " + UsersList.Keys.Count.ToString() + " current users";
 }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:22,代码来源:Admin.aspx.cs

示例9: SubmitPublishingFormClicked

    protected void SubmitPublishingFormClicked(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State, Response, "../Default.aspx")) return;

        /*if (!util.IsAppStoreSubmissionPaid(State, State["SelectedApp"].ToString()))
        {
            ProvisioningMessage.Text = "You need to first purchase one of the ViziApps services to submit the app to an app store.";
            return;
        }*/

        //check if entries were set
        DB db = new DB();
        StringBuilder b_sql = new StringBuilder("SELECT * FROM applications ");
        b_sql.Append("WHERE application_name='" + State["SelectedApp"].ToString() + "'");
        b_sql.Append(" AND customer_id='" + State["CustomerID"].ToString() + "'");
        DataRow[] rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
        DataRow row = rows[0];
        if (row["production_app_name"] == DBNull.Value || row["production_app_name"].ToString().Length == 0)
        {
            ProvisioningMessage.Text = "The Published App Name needs to be set and saved";
            return;
        }
        if (row["production_app_xml"] == DBNull.Value)
        {
            ProvisioningMessage.Text = "The Publish Design has not been saved";
            return;
        }

        string url = util.GetApplicationLargeIcon(State, State["ApplicationID"].ToString());
        if (url == null || url.Length == 0)
        {
            ProvisioningMessage.Text = "The Icon image has not been uploaded";
            return;
        }
        url = util.GetApplicationSplashImage(State, State["ApplicationID"].ToString());
        if (url == null || url.Length == 0)
        {
            ProvisioningMessage.Text = "The splash image has not been uploaded";
            return;
        }

        StringBuilder body = new StringBuilder("Customer Username: " + State["Username"].ToString() + "\n");
        body.Append("App Name: " + State["SelectedApp"].ToString() + "\n");
        body.Append("App Type: " + State["SelectedAppType"].ToString() + "\n");
        if (SubmissionNotes.Text.Length > 0)
            body.Append("Customer Notes: " + SubmissionNotes.Text + "\n");
        body.Append("\n-- ViziApps Support");

        Email email = new Email();

        string status = email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(),  HttpRuntime.Cache["TechSupportEmail"].ToString(), "", "", "Customer Submitted Publishing Form", body.ToString(), "", false);

        if (status.IndexOf("OK") >= 0)
        {
            ProvisioningMessage.Text = "Your publishing form has been received.";
        }
        else
        {
            ProvisioningMessage.Text = "There has been a problem submitting your publishing form. Please contact [email protected]";
        }

        util.SetFreeProductionExpiration(State, DateTime.Now.ToUniversalTime().AddDays(14.0D));
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:65,代码来源:PublishingForm.aspx.cs

示例10: SendMail

 public bool SendMail(string FeedbackName, string ToMail, string FeedbackEmail, string FeedbackMessage)
 {
     Email em = new Email();
     em.SendEmail("", "", "", FeedbackName, FeedbackMessage, FeedbackEmail, ToMail, "");
     return true;
 }
开发者ID:shanghaiese,项目名称:argicast,代码行数:6,代码来源:ToolBarService.cs

示例11: SendEmails_Click

    protected void SendEmails_Click(object sender, EventArgs e)
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return;

        if (EmailBody.Text.Length == 0)
        {
            Message.Text = "The email body has no text";
            return;
        }
        if (EmailSubject.Text.Length == 0)
        {
            Message.Text = "The email subject has no text";
            return;
        }

        Email email = new Email();
        FromEmail.Text = Request.Form.Get("FromEmail");
        if (FromEmail.Text.Trim().Length == 0)
        {
            Message.Text = "Set the From Email address.";
            return;
        }

        StringBuilder user_info = new StringBuilder();
        string CC = "";
        if (EmailType.Text != "Customer Email")
        {
            //get user info
            string sql = "SELECT * FROM customers WHERE username='" +  State["Username"].ToString() + "'";
            DB db = new DB();
            DataRow[] rows = db.ViziAppsExecuteSql(State, sql.ToString());
            DataRow row = rows[0];
            user_info.Append("User Information" + "\r\n");
            user_info.Append("\tCustomer Username: " +  State["Username"].ToString() + "\r\n");
            user_info.Append("\tCustomer Company: " + row["company"] + "\r\n");
            user_info.Append("\tCustomer First Name: " + row["first_name"] + "\r\n");
            user_info.Append("\tCustomer Last Name: " + row["last_name"] + "\r\n");
            user_info.Append("\tCustomer Email: " + FromEmail.Text + "\r\n\r\n");
            user_info.Append("\tCustomer Phone: " + row["phone"] + "\r\n\r\n");
            user_info.Append("Issue Information" + "\r\n");
            user_info.Append("\tIssue Category: " + Category.SelectedValue + "\r\n");

            ApplicationList.SelectedValue = Request.Form.Get("ApplicationList");
            user_info.Append("\tApplication: " + ApplicationList.SelectedValue + "\r\n");
            user_info.Append("\r\n");
        }
        else
            CC =   HttpRuntime.Cache["TechSupportEmail"].ToString();

        user_info.Append(EmailBody.Text);
        try
        {
            string status = email.SendEmail(State,   HttpRuntime.Cache["TechSupportEmail"].ToString(), ToEmail.Text, CC, "", EmailSubject.Text, user_info.ToString(), "",false);
            if (status == "OK")
            {
                if (EmailType.Text == "Customer Email")
                {
                    Message.Text = "The email was sent successfully. Close this window now.";
                }
                else
                {
                    Message.Text = "The email was sent successfully. Our ViziApps Support team will respond to you shortly. Close this window now.";
                }
            }
            else
                Message.Text = "Error: " + status;
        }
        catch (Exception ex)
        {
            util.LogError(State, ex);
            Message.Text = "Error: " + ex.Message;
        }
    }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:75,代码来源:EmailForm.aspx.cs

示例12: SendEmail

        /// <summary>
        /// SendEmail
        /// </summary>
        /// <param name="mailMessage"></param>
        public void SendEmail(MailMessage mailMessage)
        {
            try
            {
                SetupManager setupManager = new SetupManager();
                EmailConfiguration emailConfiguration = setupManager.GetEmailConfiguration();

                SmtpClient smtp = new SmtpClient();
                smtp.UseDefaultCredentials = emailConfiguration.RequireCredentials;

                if (emailConfiguration.RequireCredentials)
                {
                    smtp.Credentials = new NetworkCredential(emailConfiguration.Username, emailConfiguration.Password);
                }

                smtp.Host = emailConfiguration.HostName;

                smtp.Port = emailConfiguration.PortNumber;

                smtp.EnableSsl = emailConfiguration.EnableSSL;

                mailMessage.From = new MailAddress(emailConfiguration.DefaultSenderEmail);
                Email email = new Email(smtp);
                email.SendEmail(mailMessage);
            }
            catch(Exception ex)
            {
                log.Error(ex.Message,ex);
            }
        }
开发者ID:eCollobro,项目名称:eCollabro,代码行数:34,代码来源:CommonManager.cs

示例13: SendPasswordButton_Click

 protected void SendPasswordButton_Click(object sender, EventArgs e)
 {
     string user_email = Email.Text.Trim().ToLower();
     string sql = "SELECT username,password FROM customers WHERE email='" + user_email + "'";
     DB db = new DB();
     Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
     DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
     if (rows.Length > 0)
     {
         DataRow row = rows[0];
         string username = row["username"].ToString();
         string body = "Your ViziApps credentials are:\nUsername: " + row["username"].ToString() + "\nPassword: " + row["password"].ToString();
         Email email = new Email();
         InitPortalSession(); //to init from email
         email.SendEmail(State,  HttpRuntime.Cache["TechSupportEmail"].ToString(), user_email, "", "", "ViziApps Credentials", body, "", false);
         LoginPages.SelectedIndex = 0;
         FailureText.Text = "An email has been sent to you with your credentials.";
     }
     else
     {
         Message.Text = "The email you entered is not registered.";
     }
     db.CloseViziAppsDatabase(State);
 }
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:24,代码来源:Default.aspx.cs

示例14: Mail

        /// <summary>
        /// This method encapsulates the email function.
        /// </summary>
        /// <param name="emailTo"></param>
        /// <param name="emailFrom"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="isHtml"></param>
        private void Mail(string emailTo, string emailFrom, string subject, string body, bool isHtml)
        {
            var email = new Email
                            {
                                ToList = emailTo,
                                FromEmail = emailFrom,
                                Subject = subject,
                                MessageBody = body,
                                isHTML = isHtml
                            };

            email.SendEmail(email);
        }
开发者ID:linguado,项目名称:mundo-site,代码行数:21,代码来源:AccountController.cs

示例15: SendNotification

        protected static void SendNotification(Guid processId, List<Guid> identityId, string subject, string message, string wfinfo, NotificationTypeEnum type)
        {
            Email mailer = new Email();

            if (identityId == null)
                identityId = new List<Guid>();

            if (type == NotificationTypeEnum.NotificationWorkflowMyDocBack || type == NotificationTypeEnum.NotificationWorkflowMyDocChangeState)
            {
                var budgetItem = DynamicRepository.GetByView("BudgetItem_Edit", FilterCriteriaSet.And.Equal(processId, "Id")).FirstOrDefault();
                if (budgetItem != null)
                    identityId.Add(budgetItem.CreatorEmployeeId_SecurityUserId);
            }

            if (identityId.Count == 0)
                return;

            var userFilter = FilterCriteriaSet.And.In(identityId, "Id");

            if(type == NotificationTypeEnum.DocumentAddToInbox)
            {
                userFilter = userFilter.Merge(FilterCriteriaSet.And.Equal(true, "NotificationWorkflowInbox"));
            }
            else if(type == NotificationTypeEnum.NotificationWorkflowMyDocBack)
            {
                userFilter = userFilter.Merge(FilterCriteriaSet.And.Equal(true, "NotificationWorkflowMyDocBack"));
            }
            else if(type == NotificationTypeEnum.NotificationWorkflowMyDocChangeState)
            {
                userFilter = userFilter.Merge(FilterCriteriaSet.And.Equal(true, "NotificationWorkflowMyDocChangeState"));
            }

            var suList = DynamicRepository.GetByEntity("SecurityUser", userFilter);

            if (suList.Count == 0)
                return;

            var param = new Dictionary<string, string>();

            param.Add("Subject", subject);
            param.Add("Message", message);
            param.Add("WFInfo", wfinfo);

            AddObjectParams(param, processId,
                type == NotificationTypeEnum.NotificationWorkflowMyDocBack);

            var emailList = suList.Select(c => (string)c.Email).ToList();
            mailer.SendEmail("NotificationEmail", param, emailList);
        }
开发者ID:dmelnikov,项目名称:DWKit,代码行数:49,代码来源:Notification.cs


注:本文中的Email.SendEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。