I’m happy if I could compose an email from vim but not realistic. I’m currently using Thunderbird as the primary mail program, and he/she has a command-line interface. Thunderbird is a good mailer, and vim has a better editing environment. So I found that writing a draft in vim and transferring it to Thunderbird will give me an excellent experience.

The following code in vimscript is my option. It works well, but not perfect. It is just my first step.

function! ComposeMessage(cmdpat)
    let [l:qr, l:qt] = [getreg('"'), getregtype('"')] 
    silent norm! gvy
    let l:body = substitute(@", '\n', '\r', 'g')
    let l:bodyfile= 'Path-To-Temp-File'
    if writefile([l:body], l:bodyfile)
        echom 'Failed to write to a temp file.'
    else
        let l:cmd = printf(a:cmdpat, l:bodyfile)
        call setreg('"', l:qr, l:qt)
        echo system(l:cmd)
        if v:shell_error
            echol ErrorMsg | echom 'Failed to run ' . l:cmd | echol NONE
        endif
    endif
endfunction
vnoremap ,th :<c-u>call ComposeMessage('"Path-To-Thunderbird-Exe" -compose "format=2,message=%s"')<CR>

To transfer a composed message from vim’s buffer to Thunderbird, just visually select the text and type ,th (means THunderbird), then a composing window will appear with the body filled.

Update 2020/Oct/06

l:body includes unnecessary NL so removed it from L4.

See also: (ib’s answer in stackoverflow really helped me!)