Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: A good looking email!


Message #1 by abutramenko@b... on Mon, 30 Jul 2001 20:17:52
I wiil be appreciated if someone take a look at my code below 

and suggest me a better way for my email tobe done.

I want to retrieve from the database records where Request Date > then 14 

days and send email to ADMIN to figure out why those records without 

approval ........



**********************************************************************

Dim dtNow, a

dtNow = Now()



 Set objConnection = Server.CreateObject("ADODB.Connection") 

objConnection.Open  "PROVIDER=SQLOLEDB;" & _

                     "DATA SOURCE=SQL2000;DATABASE=itforms;" & _

                     "USER ID=comitforms;PASSWORD=comitforms;" 

     

a = DateAdd("d", -14, dtNow)             

                    

 sSQL= "Select * from test WHERE RequestDate <= '" & a & "'"               

 Set RS=objConnection.Execute(sSQL)

Response.Write (sSQL)

WHILE Not RS.EOF 



%>

<%=RS("RequestDate")%>

<%= RS("CostManName")%>



<%

p = p + RS("CostManName")

m = m + RS("RequestDate")

RS.MoveNext

Wend

                

varSubject= "e-Form Request has been expired!"

varBody = varBody & chr(13)&  "Please contact to the following Cost Centre 

Managers :" & p   & chr(13) & chr(13) 

'varBody = varBody & chr(13) 

&  "http://angelica/MyITProject/itformTestJob.asp?rid=" & RS("Req_id") &  

chr(13) & chr(13)



Set newMailObj = CreateObject("CDONTS.Newmail")

resipStr = "abutramenko@b..."

strFrom = "Reminder"

newMailObj.To = resipStr

newMailObj.From = strFrom

newMailObj.Subject = varSubject

newMailObj.Body = varBody



  newMailObj.Send

Set newMailObj = Nothing  



the result is:

Please contact to the following Cost Centre Managers :Mariana CatzMariana

CatzMariana

CatzabVCVXB@b...@baycrest.orgabVCVXB@b...

min@b... CatzMariana CatzMariana Catz





Thank you in advance.


  Return to Index