Re: How to generate html mime message?

2021-02-12 Thread Amit Ramon

Grant Edwards  [2021-02-12 22:19 -]:


On 2021-02-12, Paul Gilmartin via Mutt-users  wrote:

On 2021-02-12, at 03:15:00, Amit Ramon wrote:

Peng Yu [2021-02-07 16:34 -0600]:


I just want to generate the HTML mine message. The instruction
requires the set up of mutt, which I want to avoid. Is
`bin/plain2html` for generating HTML mime message from a plain text?



But I wonder, "Why?"  Is there an email client so broken that it can't
simply handle text/plain content?


Yes. In my experience the version of Outlook used in my office doesn't
not work well at all with text/plain. It doesn't use a fixed font and
it does something weird and unpredictabable with line endings.


What has pushed me to develop plainMail2HTML is the bad handling of
right-to-left languages in mail clients. For example, Gmail (web)
client need to be told (via settings) what language to use for its
UI. If it's, for example, English, then plain text in a RTL language will
be left aligned. If I set the language to Hebrew, then English plain text
will be right aligned. As most of my friends and colleagues of mine,
are using Gmail, sending them plain text would be inconvenient for
them.

--- Amit


Re: How to generate html mime message?

2021-02-12 Thread Amit Ramon

Hey Peng,

Peng Yu  [2021-02-07 16:34 -0600]:


I just want to generate the HTML mine message. The instruction
requires the set up of mutt, which I want to avoid. Is
`bin/plain2html` for generating HTML mime message from a plain text?


Yes, this is the tool. You can either pipe a message to it

  $ cat message.eml | plain2html

or call it as

  $ plain2html -m message.eml


Can you make the plain2html module installable so that the following
command will work? Thanks.

$ bin/plain2html
Traceback (most recent call last):
 File "bin/plain2html", line 36, in 
   from plain2html import settings
ModuleNotFoundError: No module named 'plain2html'


Unfortunately I might not have time for that right now, but you can
easily solve this problem by setting your PYTHONPATH to include the
parent directory of the 'bin' and 'plain2html' directories.

Also please note that you need to have Python docutils installed. Last
thing, currently the only parser used for processing text is for
reStructuredText (but adding others, for example for markdown, should
be pretty simple).

Best,

Amit




Re: How to generate html mime message?

2021-02-07 Thread Amit Ramon

Hello Peng,

While this might not be the answer for how to use pandoc, it is an answer
to the question in the subject, so I hope it's right.

I'm the author of https://github.com/amitramon/plainMail2HTML - this
is a simple tool that allows for generating HTML mime part from any
email sent from Mutt. Perhaps you'll find it useful.

Cheers,

Amit

Peng Yu  [2021-02-07 09:26 -0600]:


Hi,

https://unix.stackexchange.com/questions/108485/send-email-written-in-markdown-using-mutt

I see the following muttrc command is used to compose an HTML message
on the above URL. I just want to inspect the mime message in the
command line without using the GUI.

macro compose \e5 "F pandoc -s -f markdown -t html \ny^T^Utext/html;
charset=utf-8\n"
set wait_key=no

Could anybody let me know how to create the mime message using mutt
given an html file already generated by pandoc from markdown?

I understand "html; charset=utf-8" is to set the following Content-Type.

Content-Type: text/html; charset=UTF-8

But what does "y^T^U" do?

--
Regards,
Peng


--


Re: Creating HTML emails with mutt

2019-10-26 Thread Amit Ramon

martin f krafft  [2019-10-26 11:16 +1300]:


Folks,

I need to start sending out text/html alternative parts to my messages with
mutt. However, this is a rabbit hole, so if you’re afraid of those, stop
reading now.

My requirements are, in decreasing order of priority:

1. Compatible with all Gmail, Outlook, Hotmail, Apple Mail, Thunderbird, and
   whatever else many people are using these days.
2. Markdown processing of text/plain
3. multipart/alternative result, MIME compliant
4. Attachments
5. Sensible integration with mutt
6. PGP signatures
7. Inline images

and after surveying the field, and spending hours with the solutions I found
during various web searches, I am writing in to you for some feedback, input,
guidance, psycological help, and maybe even some hugs.


A few years back I developed a simple filter that does, more or less,
what you're looking for. I believe it fulfills your first 5
requirements. I've not designed nor tested it with PGP signatures or
inline images.

It serves as a replacement to Mutt's sendmail command, it processes the
text using reStructuredText (that should be easily switched with
markdown), and the result is a multipart/alternative that contains the
original message as text/plain and a text/html.

I don't know how well it complies with standards, and I haven't tested
the resulted mail with all possible email clients. I believe it works
well with Gmail and thunderbird.

If this sounds interesting, you can find it at

https://github.com/amitramon/plainMail2HTML

Hope it helps,

Amit



Re: text vs html

2019-07-09 Thread Amit Ramon

Hi,

Fred Smith  [2019-07-09 22:53 -0400]:


[ ... ]

it seems to be following this recipe and decoding the html part even
though there is a perfectly readable text part, containing a :-).

does the order of statements in mailcap matter? should I change this:

text/html; lynx -dump -vikeys -raw %s; copiousoutput; nametemplate=%s.html
text/plain; copiousoutput

to this:

text/plain; copiousoutput
text/html; lynx -dump -vikeys -raw %s; copiousoutput; nametemplate=%s.html

Or is th is problem just because Outlook is broken and instead of
issuing a font change should just embed the proper Unicode character?


The order of the entries in mailcap should not matter. When there are
multiple parts, Mutt decides which part to display based on the value
of the alternative_order setting. This is, for example, what I have in
my configuration, and it gives priority first to text/enriched, then
to text/plain, and only then to text/html.

alternative_order text/enriched text/plain text/html

Mutt will display the first type that is available in a mail. You can
read more about in the manual.

--- Amit


Re: How to tell GUI MUAs to show message in a fixed font?

2017-07-21 Thread Amit Ramon



On 2017-04-26, Grant Edwards  wrote:
> On 2017-04-26, Will Yardley  wrote:
[...]



> If there was a simple way to get mutt to auto-magically do that to
> create a multipart/alternative text and HTML message body, that
> wouldn't be that bad an option.  Though I'd probably use  rather
> than , since  is less fragile.


[...]


> > I also wouldn't be too averse to setting up some sort of scheme for
> running a message body thought asciidoc or rst to produce HTML and
> plaintext multipart alternative.

The solution I settled (and have been using for a couple weeks now) is
to use mutt's 'sendmail' configuration setting to pipe outgoing mail
to the 'muttdown' utility


I didn't know about muttdown, but I actually developed a similar
system:

https://github.com/amitramon/plainMail2HTML

I developed it specifically for Mutt, the README explains my
motivation. What it does, in short, is replacing Mutt's sendmail
command with a tool that reads the message generated by Mutt, parse
the text/plain part with a rst parser (that can easily be replaced by
a different parser), create and add to the message a text/html part,
then send it as usual.

I hope you find it useful.

Cheers,

Amit


Re: New tool for sending HTML mail with Mutt

2010-12-09 Thread Amit Ramon

Nicolas Williams nicolas.willi...@oracle.com [2010-12-08 13:25 -0600]:


On Wed, Dec 08, 2010 at 09:17:02PM +0200, Amit Ramon wrote:

Chip Camden sterl...@camdensoftware.com [2010-12-08 11:01 -0800]:
On a related topic, is there any way to get mutt to display RTL for
certain characters?  The Hebrew characters in your signature, for
instance, are displayed LTR in my mutt, so they read backwards.

Not directly. For that you have to use a bidi-aware terminal. I'm
running Mutt in Mlterm terminal emulator, which can handle LTR and RTL
quiet well (but not perfectly).


I agree, this is a job for the rendered, which is also why you shouldn't
need your plain2html program -- the web browsers displaying your email
in webmail apps should handle bi-di correctly as long as they understand
UTF-8.  Might the webmail backend be doing something wrong?


I don't agree... web browsers are not supposed to be able to know how
to render bidi text. For this reason there are dir tags in
HTML. Webmail backends are also not doing it. This is not the same as
understand UTF-8.



How would I know if the Hebrew text in your signature is displaying
correctly?  The glyphs appear to be correct.  Would inserting spaces
between the characters change the order in which they appear?  If so, my
terminal (Terminator) is not handlint bi-di correctly :(


The first Hebrew letter in my first name is Ayn, which looks
schematically like this:

   #   #
#  #
 # #
  ##
   #   #
#  #
 # #
  ##

In a correct appearance you should see it at the rightmost place on
the line that has my first name, Amit, in my signature... if it
follows the word Amit immediately after the blank space, the terminal
does not support bidi.

--

::

 Amitעמית
 Ramon   רמון


New tool for sending HTML mail with Mutt

2010-12-08 Thread Amit Ramon

Hello list,

I'd like to announce a new tool that I developed that allows sending
HTML-formatted mail from within Mutt. I know... being a Mutt's user
already means we are no big fans of HTML mail, but I had some reasons
for developing this tool, as I shall explain now.

I'm using Mutt as my main mail reader/writer for a couple of years now
and am very pleased with it. My only problem was when communicating
with people who are using web-mail for reading their mail. I'm writing
lots of mails in Hebrew, which is a right-to-left language. It seems
that many web-mail clients are not handling text/plain messages (this
is basically what Mutt sends) in some situations. The reason for that,
AFAIK, is that they just don't know the language direction and have to
make an arbitrary decision. Gmail, for example, seems to be basing
this decision on the UI language setting. If the user, for instance,
sets the language to English, a text/plain message will be
left-aligned, no matter in which language it is written. When the text
mixes words in both RTL and LTR languages, the order of the words
might be wrong. The same would happen if the UI languages is set to
Hebrew, but one tries to read a text/plain message in English. Since I
have (or just want...) to communicate with people who are not using
Mutt, and even like using web-mail clients, I decided to come up with
a solution.

The solution I came with is a 'filter' that stands between Mutt and
the actual mail-sending utility (e.g. sendmail or msmtp). Mutt is
configured to pass the mail to this new tool instead to sendmail. The
tool - plainMail2HTML - parses the mail, generates a HTML part and
attaches it to the message, and then passes it over to sendmail. So if
the original mail has only text so its type is text/plain, it would
become a multipart/alternative message that contains text/plain and
text/html parts. This is done automatically for every mail, or you can
of course configure the behavior using hooks and macros.

Another feature of plainMail2HTML is that it contains a parser that
parse reStructuredText (a text markup language) so I can control the
formatting of the mail. This parse is designed to be modular, so it
can be replaced with a different parser (although this was not yet
tried).

plainMail2HTML is written in Python and uses docutils. It also uses a
variation of docutils rst-to-html utility that reads the text and
insert direction tags into the html (dir=RTL, dir=LTR) so the
resulting HTML is BIDI-aware.

I just created a project for it on Sourceforge. I've been using it for
many months now and it's working pretty nice. It can also handle
forwarded messages and messages with attachments. It still lacks some
features and better error handling.

The project is https://sourceforge.net/projects/plain2html/

There is additional information in the README file on the project
page, and you can download a beta version. The project yet lacks
decent documentation, but I'd be glad to answer any question about it.

I hope some of you would find this interesting and perhaps even
useful. I'd be happy to hear any comments and suggestions. Developers
are welcome to join the project, too.

Best,

Amit

--

::

Amitעמית
Ramon   רמון


Re: New tool for sending HTML mail with Mutt

2010-12-08 Thread Amit Ramon

Chip Camden sterl...@camdensoftware.com [2010-12-08 11:01 -0800]:

On a related topic, is there any way to get mutt to display RTL for
certain characters?  The Hebrew characters in your signature, for
instance, are displayed LTR in my mutt, so they read backwards.


Not directly. For that you have to use a bidi-aware terminal. I'm
running Mutt in Mlterm terminal emulator, which can handle LTR and RTL
quiet well (but not perfectly).



--
Sterling (Chip) Camden| sterl...@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com| http://chipsquips.com




--

::

Amitעמית
Ramon   רמון


Re: Set terminal title when running mutt?

2009-10-22 Thread Amit Ramon


chombee wrote:

Does anyone know how I can set my terminal's window title to something 
like 'mutt /path/to/mailbox' when running mutt?


For xterm you can set the xterm_status variable, but it might not work 
with other terminals. There is a hack, however, by setting the 
status_format variable to a script that sets the title. For example, I'm 
using a little script that I called 'mutt_status':


#!/bin/sh
# Demonstration of format string pipes. Sets the xterm title to the 2nd 
argument,

# and returns the first  unchanged.
#
# this sets the title
printf \033]0;$2\007  /dev/tty
echo $1
# end of script

Then I define:

set status_format=mutt_status \$my_status\ \$my_title\|

where the variables my_status and my_title are set to a format string, 
see the documentation of status_format. I'm using this with mlterm, and 
it also works with xterm.



--- Amit