Exemplo n.º 1
0
    /* Note: SendSignUpMail() function uses seperate CustomerMail Class
     * to send the Customer info to the Class  member properties
     * which then Only sets the values form customer Obj
     */

    private void SendSignUpMail()
    {
        CustomerMail custMail = new CustomerMail();

        //Set Email Sender's Email
        custMail.EmailSender = ConfigurationManager.AppSettings["SenderEmail"];

        //Set Email Sender's password
        custMail.EmailSenderPwd = ConfigurationManager.AppSettings["SenderPwd"];

        //Set Email Sender's Host
        custMail.EmailSenderHost = ConfigurationManager.AppSettings["SmtpServerHost"];

        //Set Email Sender's Port
        custMail.EmailSenderPort = System.Convert.ToInt32(ConfigurationManager.AppSettings["SenderPortNo"]);

        //Set Email Sender's Isssl
        custMail.EmailIsSSL = System.Convert.ToBoolean(ConfigurationManager.AppSettings["IsSSL"]);

        //will take .html Email Template
        custMail.EmailSenderFilePath = "WelcomeEmailer.html";

        //will replace the [CustFullName] word from Template
        custMail.EmailContentText = custMail.EmailContentText.Replace("[CustFullName]", CustFullName);
    }
Exemplo n.º 2
0
    public void SendSignUpMail(Tuple <string, string> tupleCustomer)
    {
        //Initialize this Obj for Email
        CustomerMail custMail = new CustomerMail();

        //will take .html Email Template
        custMail.EmailSenderFileName = "WelcomeEmailer.html";

        //will set the Email subject
        custMail.EmailSubject = "Welcome To Burnt Umber";

        //will replace the [CustFullName] word from Template



        //Use Srtring Bulder class to Replace multiple things
        StringBuilder emailContentReplaceText = new StringBuilder(custMail.EmailContentText);

        emailContentReplaceText.Replace("[CustFullName]", tupleCustomer.Item1);

        emailContentReplaceText.Replace("[CustEmail]", tupleCustomer.Item2);


        //Set the replaced one text
        custMail.EmailContentText = emailContentReplaceText.ToString();

        //Set to which customer Email id
        custMail.EmailRecieverId = tupleCustomer.Item2;
        //Send mail to the recipant
        custMail.SendingMail();
    }