comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Sending HTML e-mail
Date: Wed, 27 Jan 2016 18:14:26 -0600
Date: 2016-01-27T18:14:26-06:00	[thread overview]
Message-ID: <n8bmh3$o5k$1@loke.gir.dk> (raw)
In-Reply-To: a2e513fe-a1ce-452e-903e-a497f9d83e0d@googlegroups.com

"John Smith" <yoursurrogategod@gmail.com> 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" <wlfr...@ix.netcom.com> wrote in message
>> news:a7t9abpg2p6ghs65f6agsase7cltp9ad8e@4ax.com...
>> > On Sat, 23 Jan 2016 20:25:04 -0800 (PST), John Smith
>> > <yoursu....@gmail.com> 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.







  parent reply	other threads:[~2016-01-28  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24  4:25 Sending HTML e-mail John Smith
2016-01-24 16:12 ` Dennis Lee Bieber
2016-01-26  1:09   ` Randy Brukardt
2016-01-26 23:09     ` John Smith
2016-01-26 23:18       ` John Smith
2016-01-26 23:18       ` John Smith
2016-01-27  2:29         ` Dennis Lee Bieber
2016-01-28  0:14       ` Randy Brukardt [this message]
2016-01-28  3:11         ` John Smith
2016-01-28 21:42           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox