• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Mail problem

 
Ranch Hand
Posts: 40
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

i have two classes wich one does a check for contracts that are overdue and one class that sends an email to warn the user that the conract will be expired.

When i only use the class that sends the mail, that class works fine and sends a mail.
But when i use the first class that checks the contracts and calls the Mailing class, the mail won't be sended.

Can anyone help me and say what is wrong with the first class or is it something with the call to the Mailing class?

here is the first class "Warning.java



Next is the Mailing.java class:




 
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to know contract is expired? Also, why you defined all the variables as static when you can define as local. It would be more simpler than.
 
Wim Van Geyt
Ranch Hand
Posts: 40
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tushar Goel wrote:How to know contract is expired? Also, why you defined all the variables as static when you can define as local. It would be more simpler than.



All the contracts have a during of 1, or 3 or 5 years.
So the email message has to be sended 6 months before the contract is expired.
It's based on the periode that's stored as a column in the database.

I set the variables at the top, so i can use them everywhere.

Wim
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to put System.out.println at lines 62, 68, and 73 to make sure that Mailing was called at all.
 
Tushar Goel
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need more details to help you.. like what does "180" or other means.. Also put some debugger statement to debug easily.

Secondly you are writing everything in main. So you can define it too. Otherwise, it is bad practice to write that long into the main method.
It should be spilt into small methods.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult for this forum: moving.
 
Wim Van Geyt
Ranch Hand
Posts: 40
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tushar Goel wrote:I need more details to help you.. like what does "180" or other means.. Also put some debugger statement to debug easily.

Secondly you are writing everything in main. So you can define it too. Otherwise, it is bad practice to write that long into the main method.
It should be spilt into small methods.



The variables yeaR, threeYears and fiveYears are the day when the contract is at 6 months before the expire date.
Everything is counted in days.

I 've also set the String variables to integer so i can say that every day from 180 day and behind these 180 days there has to be send an email.



Wim

 
We begin by testing your absorbancy by exposing you to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic