From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.albasani.net!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Sending HTML e-mail Date: Wed, 27 Jan 2016 18:14:26 -0600 Organization: JSA Research & Innovation Message-ID: References: <7f2111a7-a789-42c9-829b-08c2661410bd@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1453940067 24756 24.196.82.226 (28 Jan 2016 00:14:27 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 28 Jan 2016 00:14:27 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:29265 Date: 2016-01-27T18:14:26-06:00 List-Id: "John Smith" wrote in message news:a2e513fe-a1ce-452e-903e-a497f9d83e0d@googlegroups.com... > On Monday, January 25, 2016 at 8:09:57 PM UTC-5, Randy Brukardt wrote: >> "Dennis Lee Bieber" wrote in message >> news:a7t9abpg2p6ghs65f6agsase7cltp9ad8e@4ax.com... >> > On Sat, 23 Jan 2016 20:25:04 -0800 (PST), John Smith >> > declaimed the following: >> ... >> >>So, I have this question. How can I create a plain table in HTML and >> >>then >> >>send it out? >> > >> > 1) You will likely have to have the entire body of the message as HTML >> > -- not just something contained within it. (Unless you actually go to >> > the >> > extent of using multipart/mixed or some such, in which you embed >> > multiple >> > forms of the message: text/plain, text/html, etc. and let the reading >> > client pick the one it can best handle) >> >> And you really ought to do that; not all mail clients can do anything >> useful >> with HTML. >> >> Randy. > > Hi, thanks for your response. > > I don't mind building the actual String in HTML from scratch, that's easy. > The question that I have is, >once I have that built exactly how I want it, how can I send it and have it >be delivered as an HTML e-mail? It's not that easy to do. The easiest way is to use a library constructed for that purpose. I use one that originated with Tom Moran built on top of Claw Sockets or NC Sockets. (And I've more recently redesigned it to work better in my spam filter and it's related tools.) But of course to use Claw.Sockets you have to have the paid version of Claw. The original version of NC Sockets only works on Windows; I once started a more generic version but never quite finished it (maybe this year). And I note that the NC_SMTP that I have doesn't have the ability to set the content type (and even if it did, sending just an HTML message is evil -- you have to send a text equivalent along with it. Indeed, many spam filters substantially increase the spam score for messages where the text and HTML have different contents -- it's important to get that right). I've never needed that; the primary use I've had for this library is to send bounce messages for undeliverable mail -- and that is always a plain text function that does not copy much of the original message (if you include the original message, spammers will bounce spam off of your mail server in order to use it to originate the spam). One can trivially send a text message in NC_SMTP using the simple send function: NC_SMTP.Open (Session => My_Session, IP => Target_Ip); NC_SMTP.Send_Simple_Message (Session => My_Session, Sender => "randy@rrsoftware.com", Recipient => ada-comment@ada-auth.org, Subject => "Ada is great", The_Body => ...); NC_SMTP.Close (Session => My_Session); Here, the body is a linked list of Unbounded_Strings, each string representing a line (I won't show the construction of those - it should be obvious). And Target_IP can be figured out by using the Lookup_Host_Info function (this is the interface to DNS in Claw.Sockets and NC.Sockets). There's probably some public library out there that does this stuff, but I don't know anything about it. Randy.