Sending email with a Ruby script - 501 5.5.4 Invalid Address
问题 I'm trying to send email with a Ruby script, but my proof of concept isn't working. I can telnet to the mail server and send mail that way, but this script causes the mail server to raise an error: 501 5.5.4 Invalid Address #!/usr/bin/ruby require 'net/smtp' def send_email(to, subject = "", body = "") from = "my@email.com" body= "From: #{from}\r\nTo: #{to}\r\nSubject: #{subject}\r\n\r\n#{body}\r\n" Net::SMTP.start('192.168.10.213', 25, '192.168.0.218') do |smtp| smtp.send_message body, from,