Ejemplo n.º 1
0
        static void Main()
        {
            string      emailAddress = "*****@*****.**";
            string      password     = "******";
            string      stmpServer   = "smtp.gmail.com";
            int         port         = 587;
            bool        enableSSL    = true;
            EmailClient client       = new EmailClient(emailAddress, password, stmpServer, port, enableSSL);



            MonetaryDonor donor = new MonetaryDonor();

            donor.firstName          = "Jason";
            donor.lastName           = "Gaytan";
            donor.streetAddress      = "911 S. Mill Ave";
            donor.cityTown           = "Tempe";
            donor.stateProvince      = "AZ";
            donor.zipPostalCode      = "85211";
            donor.salutationGreeting = "Dear Jason";
            donor.amount             = "0.00";
            donor.donatedOn          = DateTime.Now.ToString("MMMM dd, yyyy");

            string body = HTMLLetter.getHTML(donor);
            //client.sendEmail("*****@*****.**", "Test", body);
        }
        public static string getHTML(MonetaryDonor donor)
        {
            StringBuilder html = new StringBuilder(getMonetaryHTMLTemplate());

            html.Replace(CURRENT_DATE_TAG, DateTime.Now.ToString("MMMM dd, yyyy"));
            html.Replace(FIRST_NAME_TAG, donor.firstName);
            html.Replace(LAST_NAME_TAG, donor.lastName);
            html.Replace(STREET_ADDRESS_TAG, donor.streetAddress);
            html.Replace(APARMENT_TAG, donor.apartment);
            html.Replace(CITY_TOWN_TAG, donor.cityTown);
            html.Replace(STATE_PROVINCE_TAG, donor.stateProvince);
            html.Replace(ZIP_POSTAL_TAG, donor.zipPostalCode);
            html.Replace(SALUTATION_TAG, donor.salutationGreeting);
            html.Replace(AMOUNT_TAG, donor.amount);                     // Unique
            html.Replace(DONATED_ON_TAG, donor.donatedOn);

            return(html.ToString());
        }