PDA

View Full Version : Email


twocool
05-09-2003, 03:51 AM
i got this problem where i send a email..... it never sends the approval side.... it always send the request side

this is my code

vReqNo = Request("ReqNo")
'ReqTitle = request("vreqTitle")

'sql= "SELECT OfficerIC , Director from AppnRef WHERE AppnId = 'vAppnId' "
'set rs = MSCS.execute(sql)
'vOfficerIC = rs("OfficerIC")
'vDirector = rs("Director")
'rs.close
'set rs = nothing

'sql1="Select ReqStatus from ReqStatusRef where SeqNo='2' or SeqNo='98'"
'set rs1 = MSCS.Execute(sql1)



sql2 = "select * from Requests where ReqNo='" & vReqNo & "'"
set rs2 = MSCS.Execute(sql2)
vReqtr = rs2("Reqtr")
vApprovOfficer = rs2("ApprovOfficer")
vReqtrEmail = rs2("ReqtrEmail")
vReqTitle = rs2("ReqTitle")
vAppnId = rs2("AppnId")
vreqType = rs2("reqType")
vReqStatus = rs2("ReqStatus")
vApprovEmail = rs2("ApprovEmail")
rs2.close
set rs2=nothing

'send email to approval officer
sql1 = "select * from ReqTypeRef where ReqType='" & vreqType & "'"
set rs1 = MSCS.Execute(sql1)
ReqDesc = rs1("ReqDes")
rs1.close
set rs1=nothing



'Set Mailobj = Server.CreateObject("CDONTS.NewMail")
if ReqStatus = "APPROVED" then

Set Mailobj = Server.CreateObject("CDONTS.NewMail")
Mailobj.From = "ConBiz IS Request (" & vApprovEmail & ")"
Mailobj.To ="& vReqtrEmail & " ' "("& OfficerIC &"), ("& Director &")"
Mailobj.Bcc = ""
Mailobj.Subject = "IS Request Acknowlegement"
Mailobj.Body = "Hi " & vApprovOfficer & "!" & vbCrLf & vbCrLf & _
"Request Type: " & ReqDesc & "" & vbCrLf & _
"Application Name: " & vAppnId & "" & vbCrLf & _
"Request No: " & vReqNo & "" & vbCrLf & _
"Request Title: " & vreqTitle & "" & vbCrLf & _
"Requestor: " & vReqtr & "" & vbCrLf & vbCrLf & vbCrLf &_
"The above IS Request has been received and assigned to the officer-in-charge.You" & vbCrLf & _
"should be receiving IS Response within 5 working days." & vbCrLf
Mailobj.Send
Set Mailobj = Nothing


else

Set Mailobj = Server.CreateObject("CDONTS.NewMail")
Mailobj.From = "ConBiz IS Request (" & vApprovEmail & ")"
Mailobj.To ="("& vReqtrEmail &") " ' "("& OfficerIC &"), ("& Director &")"
Mailobj.Bcc = ""
Mailobj.Subject = "IS Request Acknowlegement"
Mailobj.Body = "Hi " & vApprovOfficer & "!" & vbCrLf & vbCrLf & _
"Request Type: " & ReqDesc & "" & vbCrLf & _
"Application Name: " & vAppnId & "" & vbCrLf & _
"Request No: " & vReqNo & "" & vbCrLf & _
"Request Title: " & vreqTitle & "" & vbCrLf & _
"Requestor: " & vReqtr & "" & vbCrLf & vbCrLf & vbCrLf &_
"The above IS Request has been rejected for the following reason:"& vbCrLf & _
"RejRemarks: " & vRejRemarks & ""
Mailobj.Send
Set Mailobj = Nothing
end if

arnyinc
05-09-2003, 03:04 PM
If I understand correctly, it always executes the code in the "else" part of your if-statement.

Should the following be vReqStatus?
Is APPROVED supposed to be in all caps?

if ReqStatus = "APPROVED" then