Notification for Email Sent completion - #{message}"
end

It looks to me like you have an " to terminate a string but you don”Ēt have 
one to begin it. Because of that, It's probably encountering the word 'for' 
and interpreting it as a loop construct and it just goes over and over and 
over since there's nothing to break the loop. My guess is that the root of 
the stack level error is in the code being taken as part of the loop...

Maybe I missed it, if so, I apologize, but that's what it looks like to me. 
Hope it helps.

  - jayce

--------------------------------------------------
From: "Bezan Kapadia" <bezan99 / gmail.com>
Sent: Monday, February 09, 2009 4:28 PM
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Subject: Re: Got SystemStackError exception: stack level too deep

> I see ...
>
> My code below : The function 1 calls the function mail_system every 60
> seconds.
>
> Take a look at my 2 functions below and can u suggest of what should I
> really change to do away with this issue
>
> require 'net/smtp'
>
> def mail_system(message,i)
>
> user=`echo $USER`.chomp
> recipient=user+"@gmail.com"
> msg = "#{message}"
> Net::SMTP.start('smtp.gmail.com',25) do |smtp|
> smtp.send_message(msg, "#{recipient}", "#{recipient}")
> Notification for Email Sent completion - #{message}"
> end
> rescue Timeout::Error => e
> $mes_trace.error("Got #{e.class} exception: #{e.message}")
> puts "Got #{e.class} exception: #{e.message}"
> exit false
> end
>
>
>
> def function1
> ........
> mail_system(message,i)
> rescue Exception => e
>    $mes_trace.error("Got #{e.class} exception: #{e.message}")
>    puts "Got #{e.class} exception: #{e.message}"
> end
>
> sleep(60)
> end
>
>
>
>
>
>
> Tony Arcieri wrote:
>> On Mon, Feb 9, 2009 at 4:12 PM, Bezan Kapadia <bezan99 / gmail.com> wrote:
>>
>>> Can someone explain what does this error really mean "Got
>>> SystemStackError exception: stack level too deep" ?
>>> and if there are anything to look for or keep in mind to contain or
>>> prevent this error or some kind of work around etc...?
>>>
>>
>> It means that you have too many calls to functions which are in turn
>> calling
>> other functions before returning.  A quick and easy way to cause a
>> similar
>> error is:
>>
>>  def foo; foo; end
>>  foo
>>
>> The stack trace you get with the SystemStackError will be enormously
>> helpful
>> in diagnosing this problem.  Perhaps you can paste it to the list?
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
>