Sending email

P

Paulo

Hi, I need to send email everyday at 10PM. I've already a aspx page wich
reads the database and collects some data to be sent...

How can I configure the server to execute that asp page everyday? What do
you suggest?

Thanks in advance!
---------------------------------
sQuery = "select
n.NF,c.FANTASIA,n.DT_FAT,co.DATA_COLETA,n.DESP_QT,n.DESP_ESP,
t.FANTASIA as TRANSPORTADORA, t.TELEFONE as TEL_TRANSP,c.EMAIL
from (((NF_CAB n inner join CLIENTE c on n.CODECLI=c.CODECLI)
inner join COLETAS_GERAL co on n.NF=co.G_NRNOTA and
n.EMITENTE=co.EMITENTE)
left outer join CLIENTE t on co.CODTRANS=t.CODECLI)
where year(co.DATA_COLETA)=YEAR(getdate()) and
month(co.DATA_COLETA)=month(getdate()) and
day(co.DATA_COLETA)=day(getdate()) and co.STATUS=1 and n.DESP_FRETE=1" ;

try
{
SqlDataReader reader;
reader = SqlHelper.ExecuteReader(connectionString,
CommandType.Text, sQuery );
reader.Read(); // lê primeiro registro

while ( reader != null ) // verifica se têm dados
{

sAssunto = 'HERCULES: nota fiscal ' +
reader["NF"].ToString() + ' expedida';

sCorpo = 'Prezado(a) ' +
reader["FANTASIA"].ToString() + ', a sua nota fiscal de numero ' +
reader["NF"].ToString() + ' foi coletada
dia ' + reader["DATA_COLETA"].ToString() +
' pela transportadora ' +
reader["TRANSPORTADORA "].ToString() +
' (telefone: ' +
reader["TEL_TRANSP"].ToString() + '), constando ' +
reader["DESP_QT "].ToString() + ' ' +
reader["DESP_ESP"].ToString() ;

sFrom = "(e-mail address removed)";
sTo = "(e-mail address removed)"; //
reader["EMAIL"].ToString()

SendEmail sFrom , sTo , sAssunto, sCorpo;

reader.Read(); // lê próximo registro
}
reader.Close(); // fecha cursor
}
 
G

George Ter-Saakov

You must come up with some scheduling.

If you have an ASPX page that you need to run at 10 PM, then you need to
fire up IE at 10 PM everyday and hit that page :)

Or you can use a Windows scheduler to hit that url... Bonus is you can do it
from your home PC if the server scheduler is not available to you.

George.
 
P

Paulo

How can I fire up IE to some page? Show me how please...

Thanks

George Ter-Saakov said:
You must come up with some scheduling.

If you have an ASPX page that you need to run at 10 PM, then you need to
fire up IE at 10 PM everyday and hit that page :)

Or you can use a Windows scheduler to hit that url... Bonus is you can do
it from your home PC if the server scheduler is not available to you.

George.


Paulo said:
Hi, I need to send email everyday at 10PM. I've already a aspx page wich
reads the database and collects some data to be sent...

How can I configure the server to execute that asp page everyday? What do
you suggest?

Thanks in advance!
---------------------------------
sQuery = "select
n.NF,c.FANTASIA,n.DT_FAT,co.DATA_COLETA,n.DESP_QT,n.DESP_ESP,
t.FANTASIA as TRANSPORTADORA, t.TELEFONE as TEL_TRANSP,c.EMAIL
from (((NF_CAB n inner join CLIENTE c on n.CODECLI=c.CODECLI)
inner join COLETAS_GERAL co on n.NF=co.G_NRNOTA and
n.EMITENTE=co.EMITENTE)
left outer join CLIENTE t on co.CODTRANS=t.CODECLI)
where year(co.DATA_COLETA)=YEAR(getdate()) and
month(co.DATA_COLETA)=month(getdate()) and
day(co.DATA_COLETA)=day(getdate()) and co.STATUS=1 and n.DESP_FRETE=1" ;

try
{
SqlDataReader reader;
reader = SqlHelper.ExecuteReader(connectionString,
CommandType.Text, sQuery );
reader.Read(); // lê primeiro registro

while ( reader != null ) // verifica se têm dados
{

sAssunto = 'HERCULES: nota fiscal ' +
reader["NF"].ToString() + ' expedida';

sCorpo = 'Prezado(a) ' +
reader["FANTASIA"].ToString() + ', a sua nota fiscal de numero ' +
reader["NF"].ToString() + ' foi
coletada dia ' + reader["DATA_COLETA"].ToString() +
' pela transportadora ' +
reader["TRANSPORTADORA "].ToString() +
' (telefone: ' +
reader["TEL_TRANSP"].ToString() + '), constando ' +
reader["DESP_QT "].ToString() + ' ' +
reader["DESP_ESP"].ToString() ;

sFrom = "(e-mail address removed)";
sTo = "(e-mail address removed)"; //
reader["EMAIL"].ToString()

SendEmail sFrom , sTo , sAssunto, sCorpo;

reader.Read(); // lê próximo registro
}
reader.Close(); // fecha cursor
}
 

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top