[#25897] Mail archive searching? — "Martin J. Dürst" <duerst@...>
Why does ruby-dev's official archive
[#25928] Ruby 1.8.6-p383 hangs in dln_load on Snow Leopard — Timothy Hunter <cyclists@...>
An RMagick user reports that Ruby 1.8.6 hangs when requiring RMagick.
On Oct 3, 2009, at 4:26 PM, Timothy Hunter wrote:
On Oct 3, 10:26m, Timothy Hunter <cycli...@nc.rr.com> wrote:
[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>
Hi,
On Sun, Oct 4, 2009 at 11:47 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
[#25943] Disabling tainting — Tony Arcieri <tony@...>
Would it make sense to have a flag passed to the interpreter on startup that
2009/10/6 Tony Arcieri <tony@medioh.com>:
On Tue, Oct 6, 2009 at 3:52 AM, Yugui <yugui@yugui.jp> wrote:
[#25964] mis filed bug reports — Roger Pack <rogerdpack2@...>
If i accidentally file a bug under 1.9 that belongs in 1.8, I assume I
[#25965] [Bug #2180] request: add *Method#source_location to 1.8.x — Roger Pack <redmine@...>
Bug #2180: request: add *Method#source_location to 1.8.x
[#25969] [Bug #2181] Segmentation fault for test/drb/* -- possible bug in Marshal/GC — Nikolai Lugovoi <redmine@...>
Bug #2181: Segmentation fault for test/drb/* -- possible bug in Marshal/GC
[#26012] Segfaults after multiple call of ruby_node_run — Christoph Kappel <unexist@...>
[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>
Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error
[#26070] [Bug #2201] Process.spawn fails in 1.9.1 — Roger Pack <redmine@...>
Bug #2201: Process.spawn fails in 1.9.1
[#26087] [Bug #2212] Using a Lambda with Inappropriate Arity for Hash#default_proc= — Run Paint Run Run <redmine@...>
Bug #2212: Using a Lambda with Inappropriate Arity for Hash#default_proc=
[#26126] The fate of my keyword documentation — "David A. Black" <dblack@...>
Hi --
[#26200] [Bug #2243] Random instance variables order — Maxim Chechel <redmine@...>
Bug #2243: Random instance variables order
[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>
Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds
[#26232] [Feature #2255] unicode parameters cannot be passed to ruby — Vit Ondruch <redmine@...>
Feature #2255: unicode parameters cannot be passed to ruby
[#26237] [Bug #2256] net\ftp.rb failing on implicit cast of Pathname to string — Sai Fujinaro <redmine@...>
Bug #2256: net\ftp.rb failing on implicit cast of Pathname to string
[#26262] [Feature #2260] better access with GC_DEBUG — Roger Pack <redmine@...>
Feature #2260: better access with GC_DEBUG
[#26299] Which commit fixed Set#hash (Hash#hash, I assume) between 1.9.1 and 1.9.2? — "Shot (Piotr Szotkowski)" <shot@...>
Hello, good people of ruby-core.
[#26303] IO.foreach (and friends) effect on $< and $. — Charles Oliver Nutter <headius@...>
I have a few questions about how the line-by-line IO operations are
[#26336] [Bug #2283] Ruby 1.9.1p243 spinning with 100% CPU; perhaps rb_str_slice_bang-related — Mark Aiken <redmine@...>
Bug #2283: Ruby 1.9.1p243 spinning with 100% CPU; perhaps rb_str_slice_bang-related
[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>
Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine
Issue #2294 has been updated by Anonymous Anonymous.
Hi,
Hi,
Hi,
[#26388] suggestion: gems.ruby-lang.org — Yusuke ENDOH <mame@...>
Hi --
On Wed, Oct 28, 2009 at 3:20 AM, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
Hi,
On Wed, Oct 28, 2009 at 9:00 PM, Yusuke ENDOH <mame@tsg.ne.jp> wrote:
Hi,
[#26390] [Bug #2303] dl.so segfaults on mingw32 — Nikolai Weibull <redmine@...>
Bug #2303: dl.so segfaults on mingw32
[#26429] [Bug #2313] Incomplete encoding conversion? — Adam Salter <redmine@...>
Bug #2313: Incomplete encoding conversion?
[#26447] [Bug #2316] [BUG] cfp consistency error — Cezary Baginski <redmine@...>
Bug #2316: [BUG] cfp consistency error
[#26458] [Bug #2319] gethostbyname fails in windows — Roger Pack <redmine@...>
Bug #2319: gethostbyname fails in windows
[#26459] [Bug #2320] patch to trunk .document to include more readme's etc. — Roger Pack <redmine@...>
Bug #2320: patch to trunk .document to include more readme's etc.
[ruby-core:26150] Patch: Let Net::SMTP continu when at least one RCPT is accepted
Hi all,
While writing an SMTP daemon in Ruby, one of my tests
(that uses Ruby's existing Net::SMTP library) failed.
I was testing that my daemon will deliver mail when
only some RCPTs specified by the client were accepted.
Ruby's Net::SMTP quits when the first Unknown User is
encountered. I think Net::SMTP should continue with
other RCPTs, then use DATA to let the mail be delivered
to existing users.
I think this should be so, because
- RFC821 mentions clearly in the second paragraph in section 2
"if not, it responds with a reply rejecting that recipient
(but not the whole mail transaction)", and
- RFC2821 leaves this in the middle, but still gives
an example in section D.1 A Typical SMTP Transaction Scenario
"C: RCPT TO:<Jones@foo.com>
S: 250 OK
C: RCPT TO:<Green@foo.com>
S: 550 No such user here
C: RCPT TO:<Brown@foo.com>
S: 250 OK"
So, I wrote code to accomplish this.
Please find a patch attached.
Comments welcome, especially on the Errors constructed and returned.
They are in plain text; I can imagine making the unknown and ok
users explicit (arrays within the exception), so that code that uses
Net::SMTP has an easier time determining which emails were not sent.
Bye,
Kero.
PS: patch applies to both ruby_1_8 branch and trunk
___
How can I change the world if I can't even change myself?
-- Faithless, Salva Mea
Attachments (1)
Index: lib/net/smtp.rb
===================================================================
--- lib/net/smtp.rb (revision 25392)
+++ lib/net/smtp.rb (working copy)
@@ -50,7 +50,12 @@
include SMTPError
end
- # Represents a fatal SMTP error (error code 5xx, except for 500)
+ # Represents SMTP error code 550, user unknown
+ class SMTPUnknownUser < ProtoFatalError
+ include SMTPError
+ end
+
+ # Represents a fatal SMTP error (error code 5xx, except for 500 and 550)
class SMTPFatalError < ProtoFatalError
include SMTPError
end
@@ -452,6 +457,7 @@
# * Net::SMTPAuthenticationError
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
+ # * Net::SMTPUnknownUser
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
# * IOError
@@ -513,6 +519,7 @@
# * Net::SMTPAuthenticationError
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
+ # * Net::SMTPUnknownUser
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
# * IOError
@@ -643,6 +650,7 @@
#
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
+ # * Net::SMTPUnknownUser
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
# * IOError
@@ -651,8 +659,10 @@
def send_message(msgstr, from_addr, *to_addrs)
raise IOError, 'closed session' unless @socket
mailfrom from_addr
- rcptto_list to_addrs
- data msgstr
+ ok_users, unknown_users = rcptto_list to_addrs.flatten
+ res = data msgstr
+ raise SMTPUnknownUser, "Unknown users: #{unknown_users.join', '}, mail delivered to #{ok_users.join', '}" if not unknown_users.empty?
+ res
end
alias send_mail send_message
@@ -697,6 +707,7 @@
#
# * Net::SMTPServerBusy
# * Net::SMTPSyntaxError
+ # * Net::SMTPUnknownUser
# * Net::SMTPFatalError
# * Net::SMTPUnknownError
# * IOError
@@ -705,8 +716,10 @@
def open_message_stream(from_addr, *to_addrs, &block) # :yield: stream
raise IOError, 'closed session' unless @socket
mailfrom from_addr
- rcptto_list to_addrs
- data(&block)
+ ok_users, unknown_users = rcptto_list to_addrs.flatten
+ res = data(&block)
+ raise SMTPUnknownUser, "Failed to deliver for #{unknown_users.join', '}, succesful for #{ok_users.join', '}" if not unknown_users.empty?
+ res
end
alias ready open_message_stream # obsolete
@@ -830,9 +843,19 @@
def rcptto_list(to_addrs)
raise ArgumentError, 'mail destination not given' if to_addrs.empty?
- to_addrs.flatten.each do |addr|
- rcptto addr
+ unknown_users = []
+ to_addrs.each do |addr|
+ begin
+ rcptto addr
+ rescue SMTPUnknownUser
+ unknown_users << addr
+ end
end
+ if unknown_users.length == to_addrs.flatten.length
+ raise SMTPUnknownUser, "Unknown users: #{unknown_users.join', '}"
+ else
+ [to_addrs - unknown_users, unknown_users]
+ end
end
def rcptto(to_addr)
@@ -997,6 +1020,7 @@
when /\A4/ then SMTPServerBusy
when /\A50/ then SMTPSyntaxError
when /\A53/ then SMTPAuthenticationError
+ when /\A550/ then SMTPUnknownUser
when /\A5/ then SMTPFatalError
else SMTPUnknownError
end