Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

URI::MailTo#to_mailtext

() -> ::String
to_mailtext

Returns the RFC822 e-mail text equivalent of the URL, as a String.

Example:

Example
require 'uri'

uri = URI.parse("mailto:[email protected]?Subject=subscribe&cc=myaddr")
uri.to_mailtext
# => "To: [email protected]\nSubject: subscribe\nCc: myaddr\n\n\n"
See also #to= #to_rfc822text #set_to #to_s also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0