Hi, (the mail is long but the solution could be small)
I have the following code in an agent to send out mails when the phase dates have passed for a project. It has to send mails for each matching record in the record set which is filledup by a stored procedure.
The stored procedure is returning records and all the data into all the fields is coming properly. Everything is working fine except for one thing. When sending out the mail, the agent is not able to recognize the value in the line....
docmail.SendTo = LastModifiedBy
It is not able to match the name with a name in the address book and hence is just sending a mail to...
docmail.CopyTo = "Parameshwar Y Rao"
The stored procedure actually returns names as a string and if for the same project there is more than one resource, the stored procedure returns the value for myrs.fields(5).value as "PersonName1,PersonName2,PersonName3"
So I thought when we place such a string in the TO field and send mail to it, the mail will reach all the people. But this is not happenig.
Can someone tell me how do I acheive this.
Thanks for your time.
Regards,
Param
myConString = "DRIVER=SQL Server;SERVER=;DATABASE=;User ID=;Password="
Set myDBcon = createobject("ADODB.Connection")
Set myRS = createobject("ADODB.Recordset")
'mydbcon.ConnectionTimeout = 600
If mydbcon.state = adStateClosed Then mydbcon.open myConString
SQL = "exec proc1"
If myRS.state = adStateOpen Then myRS.Close
myRS.cursortype = adopenstatic
myrs.open sql, mydbcon
ProjectID = ""
ProjectName = ""
SubProjName = ""
PhaseName = ""
PhaseEndDt = ""
LastModifiedBy = ""
aLog.OpenAgentLog
While Not myRS.eof
ProjectID = myrs.fields(0).value
ProjectName = myrs.fields(1).value
SubProjName = myrs.fields(2).value
PhaseName = myrs.fields(3).value
PhaseEndDt = myrs.fields(4).value
LastModifiedBy = myrs.fields(5).value
docmail.Form = "Memo"
docmail.Principal="Main Mail ID"
docmail.Subject = "Phase Metrics for " & ProjectName & " exceded."
docmail.SendTo = LastModifiedBy
docmail.CopyTo = "Parameshwar Y Rao"
If Date >= Cdat(PhaseEndDt) Then
docmail.body = "Greetings, " & Chr$(10) & Chr$(10) & _
"Project Name:" & ProjectName & Chr$(10) & _
"SubProject Name:" & SubProjName & Chr$(10) & Chr$(10) & _
"This is a reminder that the '" & PhaseName & "' phase has ended for project number " & ProjectID & _
" on " & PhaseEndDt & " and the " & _
"next phase has not been activated. Either activate your next phase or adjust your phase dates. " & _
Chr$(10) & Chr$(10) & "Thank You."
Call docmail.Send(False)
End If
myRS.MoveNext
Wend
Exit Sub

Agent not able to recognize mail ad... (Parameshwar Y R... 29.Jul.05)
. . 