Project

General

Profile

Actions

Feature #17047

open

Support parameters for MAIL FROM and RCPT TO

Added by c960657 (Christian Schmidt) over 4 years ago. Updated about 3 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:99308]

Description

Proposal

In Net::SMTP, add support for parameters for MAIL FROM and RCPT TO, such as SMTPUTF8 and REQUIRETLS.

I suggest extending Net::SMTP#mailfrom and Net::SMTP#rcpto so they accept an additional optional Array or Hash of parameters.

For Net::SMTP#send_message and Net::SMTP#open_message_stream, I suggest that in addition to a String email address (or arrays of Strings), these methods should accept a pair (or arrays of pairs) of [addr, params], where addr is the String email address, and params is an Array or Hash of parameters.

In order for the parameters to be useful, we should expose the capabilities reported by EHLO, so capable? should be made public.

Pull request: https://github.com/ruby/ruby/pull/3359

Actions #1

Updated by c960657 (Christian Schmidt) over 4 years ago

  • Description updated (diff)
Actions #2

Updated by c960657 (Christian Schmidt) over 4 years ago

  • Description updated (diff)
Actions #3

Updated by c960657 (Christian Schmidt) over 4 years ago

  • Description updated (diff)

Updated by c960657 (Christian Schmidt) about 4 years ago

I am new to Ruby development. Please let me know if I need to do anything else to get this patch accepted.

Updated by c960657 (Christian Schmidt) about 4 years ago

I would appreciate some feedback on this. Thanks :-)

Updated by jeremyevans0 (Jeremy Evans) about 4 years ago

c960657 (Christian Schmidt) wrote in #note-5:

I would appreciate some feedback on this. Thanks :-)

Sorry for the lack of response. Please close your ruby/ruby pull request and submit a pull request to the upstream net-smtp repository: https://github.com/ruby/net-smtp/pulls

Updated by c960657 (Christian Schmidt) over 3 years ago

I would still appreciate some feedback on this :-)

Updated by xtkoba (Tee KOBAYASHI) over 3 years ago

I am sorry that I cannot evaluate the importance of this proposal.

Are there any real-world use cases of SMTPUTF8 or REQUIRETLS or any other optional parameters for MAIL or RCPT commands?

Updated by c960657 (Christian Schmidt) over 3 years ago

I must admit that I don't know how widely supported these are. I doubt they are widely used.

Introducing new standards is often a chicken-or-egg problem. Why would anybody spend time on implementing a standard that nobody else supports?

SMTP parameters is a general mechanism which is potentially useful also for future standards. If parameters were supported in Net::SMTP, early adopters could more easily start experimenting with new standards and in that way encourage others to do the same.

Regarding SMTPUTF8:
There has been talk about email addresses with non-ASCII characters on the left and right side of the @ sign for ages, and different approaches have been published in RFCs over the years. After a decade or two of patience, non-ASCII domains finally work in web browsers. Email is not there yet, but I feel confident that it will get there eventually, based on SMTPUTF8 or something else.

Both Gmail and Outlook.com announces support for SMTPUTF8 in their EHLO response, but AFAIK they do not allow users to create email accounts with non-ascii characters. I suspect they don't want to offer such addresses, because using such an address in practice is an uphill struggle due to lack of support in other parts of the email ecosystem (including Ruby-based applications :-)).

If Gmail started offering non-ascii email addresses tomorrow, Net::SMTP would not be able to send to those addresses in an RFC-compliant way. Gmail might just accept the addresses anyway without requiring SMTPUTF8 keyword, assuming that most SMTP servers just pass the 8-bit addresses through without validation. But trying to stick to RFCs seems like a safer choice.

Regarding REQUIRETLS:
This is a fairly new standard (RFC published in late 2019). That alone indicates that people in the RFC community considers this an important issue to address. I am somewhat skeptical whether REQUIRETLS will get enough traction. The issue of enforcing TLS in outgoing emails could be addressed in a simpler (but less flexible) way, e.g. using a global setting in the SMTP server.

Updated by duerst (Martin Dürst) over 3 years ago

xtkoba (Tee KOBAYASHI) wrote in #note-9:

I am sorry that I cannot evaluate the importance of this proposal.

Are there any real-world use cases of SMTPUTF8 or REQUIRETLS or any other optional parameters for MAIL or RCPT commands?

SMTPUTF8 is getting more and more supported. ICANN has an "Universal Acceptance" group that provides all kinds of resources. For example, you can check whether your email provider supports SMTPUTF8 at https://uasg.tech/eai-check/ (mine does, didn't know). More resources at https://www.icann.org/ua. It would be great if Ruby would support it, too. My understanding is that it gets used more and more in countries such as China and India,...

Updated by tommy (Masahiro Tomita) about 3 years ago

How about this: https://github.com/ruby/net-smtp/pull/34

For example, to send MAIL FROM:<sender@example.com> size=12345 and RCPT TO:<rcpt@example.com> notify=success:

smtp.send_message("msg", Net::STMP::Address.new("sender@example.com", size: 12345),
  Net::SMTP::Address("rcpt@example.com", notify: :success))

Updated by c960657 (Christian Schmidt) about 3 years ago

tommy (Masahiro Tomita) wrote in #note-12:

How about this: https://github.com/ruby/net-smtp/pull/34

👍

Probably a good idea to make it a bit more explicit than my proposal.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0