* Sergey Poznyakoff <g...@gnu.org.ua> [2021-06-05 17:42]:
> Hi Jean,
> 
> > I am using rcd-mail.el package as bindings to GNU Mailutils "mail"
> > program for quite some time.
> > 
> > https://hyperscope.link/3/8/3/0/3/rcd-mail-el-GNU-Mailutils-mail-program.html
> 
> Thanks for the heads up.  That looks promising.
> 
> > Improvements are welcome, especially I have not found a solution to
> > use comma in email addresses, and I did tried quoting in various
> > ways. 
> 
> Can you describe me the exact usecase?  What kind of email addresses you
> have difficulties using?

Like this:

name = "Dan, III"

email = "s...@example.com"

I am using this function and simply replacing comma with space (which
is incorrect):

(defun rcd-mailutils-mail-to (to-email &optional to-name)
  "Return list with \"mail\" program arguments with TO-EMAIL.

Optionally provide TO-NAME, the name of recipient of email."
  (let ((to-name (replace-regexp-in-string "," " " to-name)))
    (cond ((and (stringp to-name) (string-match "@" to-name)) (list to-email))
          ((not (seq-empty-p to-name)) (list (concat (rcd-rfc2047-encode 
to-name) " <" to-email ">")))
          (t (list to-email)))))

(setq to-name "Dan, III")
(setq to-email "s...@example.com")
(concat (rcd-rfc2047-encode to-name) " <" to-email ">") ⇒ "=?utf-8?Q?Dan,_III?= 
<s...@example.com>"

That email address will be later expanded to 2 email addresses when
given to sendmail, so anything after comma or before comma, becomes a
new email address with local hostname as sender.

I have tried this, but did not result well, same thing:

(concat "\"" (rcd-rfc2047-encode to-name) "\"" " <" to-email ">") ⇒ 
"\"=?utf-8?Q?Dan,_III?=\" <s...@example.com>"



Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/

Reply via email to