Bug in open_message_stream of Net::SMTP?

L

Lars Hoss

Hi all!

The following sample code doesn't work for me:

Net::SMTP.start("smtp.mac.com", 25) do |smtp|
smtp.open_message_stream(from_addr, [to_addr]) do |f|
f.puts "Subject: test message"
f.puts
f.puts "This is a test message"
end
end

This is the result:
-----------------------------------------
From (e-mail address removed) Wed Jan 26 14:20:35 2005
Return-path: <[email protected]>
... snip
Message-id: <[email protected]>
Original-recipient: rfc822;[email protected]



Subject: test message

This is a test message
-----------------------------------------

I wonder where the empty lines after the "Original-recipient" come from?
Using send_message, however, works fine:

msgstr = <<EOF
Subject: test message

This is a test message
EOF

Net::SMTP.start("smtp.mac.com", 25) do |smtp|
smtp.send_message msgstr, from_addr, to_addr
end

Regards,
Lars
 
M

Minero Aoki

Hi,

In mail "Bug in open_message_stream of Net::SMTP?"
Lars Hoss said:
The following sample code doesn't work for me:

Net::SMTP.start("smtp.mac.com", 25) do |smtp|
smtp.open_message_stream(from_addr, [to_addr]) do |f|
f.puts "Subject: test message"
f.puts
f.puts "This is a test message"
end
end

This is the result:
I wonder where the empty lines after the "Original-recipient" come from?
Using send_message, however, works fine:

Sorry, I forgot to backport a patch from 1.9.
Use this patch:

--- lib/net/protocol.rb 18 Aug 2004 14:42:04 -0000 1.73.2.1
+++ lib/net/protocol.rb 26 Jan 2005 14:06:47 -0000
@@ -403,7 +403,7 @@
end

def puts( str = '' )
- write str.sub(/\n?/, "\n")
+ write str.chomp("\n") + "\n"
end

def printf( *args )


Regards,
Minero Aoki
 
L

Lars Hoss

Thanks for the quick feedback. I simply was puzzled wether I it was
mine or Net::SMTP's failure :)

Regards,
Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

net/smtp 3
net/smtp 6
Help with NET::SMTP 13
Using TLS/SSL with Net::SMTP 0
Simple SMTP server in ruby 2
net/smtp question 0
net/smtp question 6
net/smtp Multiple Email recipients Issue 2

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top