# Mail send alert to user

**URL:** <https://www.ruby-forum.com/t/mail-send-alert-to-user/116205>\
**Category:** Rails\
**Created:** [October 3, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/mail-send-alert-to-user/116205 "2007-10-03T13:15:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bebitzaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b782af/32.png) [@bebitzaa](https://www.ruby-forum.com/u/bebitzaa)\
**Post date:** [October 3, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/mail-send-alert-to-user/116205/1 "2007-10-03T13:15:50Z")

</div>

Hello,  
I have made an message send/receive system for my page in ruby on rails.  
It works great but the only thing is that i need to refresh every time  
the page to see if i have new messages. Could someone help me with a  
tutorial, or example of how to send alert from server to user window  
when he get a new message.  
I don’t wan’t to put an observer function to refresh the page every 10  
seconds. I wan’t to tell to the application when a new row is inserted  
in message table to notice user that he gets a new message(like google).  
Thanks

---

<div class="post-metadata">

**Author:** ![bebitzaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b782af/32.png) [@bebitzaa](https://www.ruby-forum.com/u/bebitzaa)\
**Post date:** [October 3, 2007, 3:24pm UTC](https://www.ruby-forum.com/t/mail-send-alert-to-user/116205/2 "2007-10-03T15:24:19Z")

</div>

I believe that google actually refreshes periodically - not the html  
page,  
but gmail is basically one big javascript framework so it amounts to the  
same thing.

anyway, what you can do is create a periodic call to the server - every  
10  
seconds, 30 seconds, whatever - to check if there is a new entry - if  
there  
is no new entry, do nothing (user doesn’t experience anything) - if  
there is  
new entry you can insert the new entry using page.insert instead of  
reloading the entire page. you can also update a section showing when  
last  
the page was updated.

that would be my suggestion, but I am sure there are other people who  
can  
suggest alternatives

regards  
ivor
