Sending email in HTML format directly from filePro

Larry Hoover larry at hoovercs.com
Wed Dec 7 08:08:34 PST 2011


On 12/05/11 1:50 PM, Brian K. White wrote:
> On 12/4/2011 10:40 PM, filePro List wrote:
>> On 12/04/11 2:01 PM, Brian K. White wrote:
>>> On 12/4/2011 1:05 PM, Jay Ashworth wrote:
>>>> ----- Original Message -----
>>>>> From: "Bill Campbell"<bill at celestial.com>
>>>>
>>>>> On Sat, Dec 03, 2011, Larry Hoover wrote:
>>>>>> I'm creating emails directly from filePro and sending them out via
>>>>>> mutt
>>>>>> in Linux. I am successful with plain text emails, but html format does
>>>>>> not render in html. Has anyone done this? Can it be done? Is it a
>>>>>> function of the mutt or sendmail?
>>>>>
>>>>> This sounds like you're not getting the proper mail headers and
>>>>> MIME parts right.
>>>>
>>>> I don't believe that mutt knows *how* to original HTML emails.
>>>>
>>>> Larry needs to understand, if he doesn't already, that HTML email *must*
>>>> be MIME multipart/alternative with a text/plain and a text/HTML part,
>>>> and
>>>> *should* have some useful content in the text/plain part to avoid
>>>> pissing
>>>> off recipients who cannot (or like me, choose not to) read HTML email.
>>>>
>>>> (There are good security reasons not to read HTML email...)
>>>>
>>>> Cheers,
>>>> -- jra
>>>
>>> You can send a pure html email without any multipart mime just by
>>> putting content-type: text/html in the regular mail headers.
>>>
>>> I don't know how to make mutt do it because I generate my emails
>>> directly, including headers and feed them into sendmail, no mutt or
>>> other mua.
>>>
>>> mutt is just a convenience to get attachements encoded into base64 and
>>> generate a few lines of mime headers. You can do it yourself almost as
>>> easily and get a lot more flexability, not to mention replacing an
>>> external black box, mutt, with some filepro and/or shell code of your
>>> own that will never change how it works except when you want it to, will
>>> never not-work etc.
>>>
>>> Generate a text file test.eml that looks like this, not including the
>>> "--------":
>>>
>>> --------
>>> To: larry at hoovercs.com
>>> From: larry at hoovercs.com
>>> Subject: test message
>>> Content-Type: text/html
>>>
>>> <html><body>
>>> This is a<b>bold</b>  new test.
>>> </body></html>
>>> --------
>>>
>>> Now feed this file into "sentmail -ti" (it usually doesn't matter what
>>> MTA you really have, smail, qmail, postfix, mmdf, or actual sendmail,
>>> they all have a program or symlink called "sendmail" and all takes the
>>> most common sendmail arguments.
>>>
>>> sendmail -ti<  test.eml
>>>
>>> That's it.
>>> Just cut&paste the thing above and try it right in a shell session.
>>>
>>> The sweet trick for filepro is to take regular old print output and
>>> print it to a file with nocodes, that stick it into a minimal file like
>>> above with only the<pre></pre>  tag around the whole thing.
>>>
>>> --------
>>> To: larry at hoovercs.com
>>> From: larry at hoovercs.com
>>> Subject: test message
>>> Content-Type: text/html
>>>
>>> <html><body><pre>
>>> (entire filepro form printed with nocodes)
>>> </pre></body></html>
>>> --------
>>>
>> Thanks to all responses. When I do what Brian says above, it hangs in
>> the sendmail queue when sent directly via sendmail -it. When done via
>> mutt with" "mutt -F /muttrc -s html larry at hoovercs.com<  testmail", it
>> sends the email out immediately, but arrives in plain text and looks
>> like this (without the dashes):
>>
>> -------------------------
>> To: larry at hoovercs.com
>> From: larry at hoovercs.com
>> Subject: test message
>> Content-Type: text/html
>>
>> <html><body>
>> This is a<b>bold</b>  new test.
>> </body></html>
>> -------------------------
>> .
>>
>
> That result from mutt is entirely expected since you used an MUA (mutt)
> to generate the mail headers and so everything in testmail was just body
> text, and not parsed by any of the mail servers or final client.
> So of course it's not interpreted as html. The content-type line is just
> meaningless body text instead of being part of the actual headers.
>
> There are any number of reasons the direct sendmail didn't work because
> there are any number of ways to configure, and misconfigure, mail
> spoolers, servers, and clients.
>
> I intentionally didn't get into any of that and just assumed you had a
> working local server config as a base starting point. The fact that you
> can send with mutt doesn't mean much because for all I know maybe you
> have mutt configured to use some external mail server directly instead
> of configuring the local mail server to use that same external mail
> server as a smart host. I don't know, could be any number of things like
> that.
>
> There are debugging options you can add to the sendmail command line to
> dump a lot of verbose messages that should tell you why it's hanging or
> what it's trying to do while it's hanging.
>
> Also consult the docs for whatever mail server you have installed and
> verify that "sendmail -ti" does something that makes sense in context.
> -t and -i are pretty standard options but it's still possible your mail
> server doesn't understand them or uses them to mean something else.
> For that matter, maybe you just need to seperate them into "-t -i"
> instead of "-ti"
> The reason I specified them is because:
> -i     When reading a message from standard input, don't treat a line
> with only a . character as the end of input.
> -t     Extract recipients from message headers.
>
> This means it reads all data till end of file and you don't need to add
> a special end-of-email line which is a single dot, and that if by chance
> the email happened to have a line with a single dot, it wouldn't end the
> email right there.
>
> And it means you don't have to worry about putting subject and
> destination stuff on the command line, the command line can be fixed
> always the same, maybe inside a script, and the To: address comes from
> the mail file itself.
>
> If "man sendmail" on your box doesn't show that, then adjust as implied
> by whatever your "man sendmail" does say.
>
> I can't figure it all out for you, I can only tell you it's a definitely
> working method, and working in general for anyone, not just by luck
> working for me the way mutt seems to be by luck working for you.
> You have to take that hint and figure out the details for your own box.
>

Brian, That worked great once I got the sendmail working.  Thanks so 
much for the reply.  I always appreciate your responses and those of 
everyone on this list.


More information about the Filepro-list mailing list