retry
will execute the entire begin
block, so in your case all the email loops will run again.
Here's a quick example, which will print integers 1 through 7 continuously (terminate with CTRL-C, as it will infinite loop):
begin
(1..10).each do |x|
puts x
if x > 6
STDIN.gets # press enter to do another iteration
raise ArgumentException
end
end
rescue
retry # loop will restart from 1
end