Ruby: net/smtp weirdness - to address can't contain dash/hyphen (-)
I am using code like this to send emails from a CGI script:
Net::SMTP.start('smtp.example.com', 25) do |smtp|
smtp.open_message_stream('email@example.com', ['firstname.lastname@example.org']) do |f|
f.puts 'From: email@example.com'
f.puts 'To: firstname.lastname@example.org'
f.puts 'Cc: email@example.com'
f.puts 'Subject: test message'
f.puts 'This is a test message.'
and this is failing silent in my case.
I have discovered through trial and error that if I remove the -(dash) from the to address it works. Dashes in from or CC addresses does not matter.