c# 3.0 - How to Send automatic emails like newsletter -


i see question closed administrator similar question. try explain in detail solution i'm looking for:

first i'm trying develop windows console application.

sending frequency: monday friday

how many users: 5 20

format of data: table rows countries , columns different types of products , cells represent sale of country-product

limitation: service users prefer not use pdf or excel or attachment of type should html format possible show in body of mail

currently creating report artisan like:

..... var mystringbuilder = new stringbuilder("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">"); mystringbuilder.append("<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\">"); mystringbuilder.append("</head><body>"); mystringbuilder.appendline(); mystringbuilder.append("<table style=\"font-family: calibri; text-align: right; font-size: x-small;\">"); mystringbuilder.appendline(); var header = new stringbuilder("<tr><th>a</th><th>categ1</th><th>categ2</th><th>categ3</th><th>categ4</th><th>total</th></tr>"); var line = new stringbuilder("<tr><td>a</td><td>b</td><td>c</td><td>z</td><td>e</td><td>f</td></tr>"); foreach (var in _actuals)         {             line.replace("a", a.countryname);             if(a.segment.tolowerinvariant().equals("categ1")) {                line.replace("b", "[" + string.format("{0:0,#}", a.lsvlcfact / 1000) + "]"); }             else if (a.segment.tolowerinvariant().equals("categ2")) {                line.replace("c", "[" + string.format("{0:0,#}", a.lsvlcfact / 1000) + "]"); }             else if (a.segment.tolowerinvariant().equals("categ3")) {                line.replace("z", "[" + string.format("{0:0,#}", a.lsvlcfact / 1000) + "]"); }              else {                line.replace("e", "[" + string.format("{0:0,#}", a.lsvlcfact / 1000) + "]"); }           }  ..... 

and in class send mail like:

    public void sendresumen(string subject ,stringbuilder content)     {         var omsg = new mailmessage...;         ... add users         omsg.subject = subject;         var mimetype = new contenttype("text/html");         var alternate = alternateview.createalternateviewfromstring(content.tostring(), mimetype);         omsg.alternateviews.add(alternate);         omsg.isbodyhtml = true;         var cli = client();         cli.send(omsg);     } 

finally, hope understand i'm doing , question is: there tool can use not generate crafted message body?

i have vb application can send out messages have html payload, , doesn't use alternateview functionality.

dim mail new mailmessage(fromuser.email, touser.email) mail.subject = subject mail.isbodyhtml = true mail.body = message 

while nice use alternateview functionality email clients can't read html payload, code can't use because you're supplying html message. if did manage alternateview functionality work here, client couldn't read html see html markup instead of simple message text. work, think need provide both text , html email message body.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -