Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending a email automatically without event  RSS feed

 
Om sai
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai

I am doing a project in which i have to send mail to users automatically without any event, i need to send this on date change. my project is basically astrology so i need to send my report everyday.

I am doing on JSP

thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If by this you mean that you want to send automatic e-mails to a list at set daily intervals (like at midnight) then JSP is not an appropriate technology choice.

What you need is either a daemon program that will run in the background and "wake up" at appropriate times to peform its function, or a small standalone application that can be triggered as a cron job.
 
dasari sudha
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by Deamon programs can you suggest me some useful links regarding this
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Om sai:
I am doing a project in which i have to send mail to users automatically without any event, i need to send this on date change.


I think "date change" is an event.
 
Aodhan Hoffman
Ranch Hand
Posts: 35
Java MyEclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IIUC, to create a daemon, simply write a headless app that runs in the background that checks the date every minute or so for a date change. This would be implemented in regular java, not JSP or Servlets.

I wrote an app to upload data to a database every hour, and used UNIX cron to call it. I figured that would be more reliable.

You could write all of the email code into JSP, and call the JSP using a shell script using some type of system schedule ( whether you're using Windows or UNIX ). Not pretty, but simple if you want to stick to JSP.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the point of writing it as a JSP then?
Why not just write it as a standalone Java app?
 
Aodhan Hoffman
Ranch Hand
Posts: 35
Java MyEclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*shrug*
I wrote my app as a stand alone using crond, but the poster's needs might require JSP, or might be more interested/comfortable with JSP. I didn't say it was a great idea, only a possibility.
 
Andreas Guther
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look into java.util.Timer?
 
Andreas Guther
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and then there is also Quartz:

http://www.opensymphony.com/quartz/
 
Rajagopal Manohar
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
What's the point of writing it as a JSP then?
Why not just write it as a standalone Java app?


We had a similar requirment where we had to send E-mails automatically at specified intervals of time

But the content could be edited before the time by 3-4 people.

So we went for jsp so that these people could edit or add content

is it possible to do it in a better way
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is a request/response technology.
If you just need something to connect to a database and email messages, it seems like it would be much simpler to do this from a stand alone java app.
You could still allow users to edit the content from a browser with JSP by either writing the content to shared files or to a common database.

Of course you could have the best of both worlds if you put all the email functionality into a JavaBean that can be invoked from either a standalone app or a Servlet/JSP.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!