Ok, thanks for the clarification.
In case someone needed, here is the source code.
This is a general bulk send mail app. I made it using Firebird database. You can change to any database, just change the JDBC.
On your database, you should create these tables :
CREATE TABLE T_MAIL
(
ID Integer NOT NULL,
SNT_TO Varchar(100) NOT NULL,
SUBJECT Varchar(100) NOT NULL,
BODY Varchar(640) NOT NULL,
DT2SND Date NOT NULL, /* date email must send*/
DTSNT Timestamp, /* date & time actual email sent*/
FAILED Smallint DEFAULT 0 NOT NULL,
PRIMARY KEY (ID)
);
CREATE INDEX IDX_MAIL1 ON T_MAIL (DTSNT);
To send mails, just insert data to this table (insert id,snt_to,subject,body,dt2snd)
CREATE TABLE M_INIT
(
TAG Varchar(20) NOT NULL,
VAL Varchar(40),
PRIMARY KEY (TAG)
);
INSERT INTO M_INIT (TAG, VAL) VALUES ('Time 2 Sent Mail', '10');
INSERT INTO M_INIT (TAG, VAL) VALUES ('Interval (mn)', '10');
This is table for settings,
- Time 2 Sent Mail : email will send if current time is > 10
- Interval (mn) : app will check for new data every 10 minutes
CREATE TABLE ERR_LOG
(
MAIL_ID Integer,
ERR Varchar(1000)
);
Table to log if mail failed to sent. Mail_Id = Id in table MAIL.