Mailing problem

HI ALL

I have a problem of sending mails

i mail view from that i ill check the date if date is todays date then that mail shd go as alink to assined person

then it go to second document same process

problem is mail is going but i m using while loop because of this

for 1st person 1 mail 2nd erson 2mails 3 rd perwon 3 mails on son…

how to over come this…

Subject: mailing problem

Could you show us the code ??

Subject: RE: mailing problem

Sub Initialize Dim ss As New NotesSession

Dim db As NotesDatabase 

Dim doc As NotesDocument 

Set db=ss.CurrentDatabase 

Dim view As NotesView 

Set view =db.GetView ("NM")

Dim maildoc As New NotesDocument (db)

Dim maildoc1 As New NotesDocument (db)

Dim rtf1 As New NotesRichTextItem(maildoc1,"body")

Dim rtf As New NotesRichTextItem (maildoc,"body")

Dim style As  NotesRichTextStyle 

Set style = ss.CreateRichTextStyle

Dim datetime As New NotesDateTime ("today")



Dim level2date As String ,status As String 

Dim level3date As String ,currentdate As String 

Dim level4date As String ,test1 As String 

Dim level1date As String ,mailname As String 

currentdate=datetime.LSLocalTime

Set doc=view.GetFirstDocument

While Not doc Is Nothing

	Dim keys( 1To 6) As String 

	keys(1)=doc.txt_app1(0)

	keys(2)=doc.txt_app2(0)

	keys(3)=doc.txt_app3(0)

	keys(4)=doc.txt_app4(0)

	keys(5)=doc.txt_app5(0)

	keys(6)=doc.txt_cname(0)

	status=doc.txt_status(0)

	level1date=doc.dat1(0)

	level2date=doc.dat2(0)

	level3date=doc.dat3(0)

	level4date=doc.dat4(0)

	test1=doc.test1(0)

	'this mailing code for escalation users

	style.Bold =True

	style.NotesColor =COLOR_BLUE

	Call rtf.AppendStyle(Style)

	Call rtf.AppendText ("Dear")

	Call rtf.AddNewline (2)

	Call rtf.AppendText (doc.txt_app2(0))

	Call rtf.AddNewline (4)

	style.Bold =True

	Style.NotesFont = FONT_COURIER

	style.NotesColor =COLOR_RED

	Call rtf.AppendStyle(Style)

	Call rtf.AppendText ("The Following  Complaint Details Are Still Pending From ........")

	Call rtf.AddNewline (1)

	style.Bold =True

	Style.NotesFont = FONT_COURIER

	style.NotesColor =COLOR_BLACK

	Call rtf.AppendStyle(Style)

	Call rtf.AppendText ("%-------------------------------------------------------------------------------------%")

	Call rtf.AddNewline (1)

	Call rtf.AppendText ("Complaint Raised Date:-                          "+"  "+doc.txt_dat(0))

	Call rtf.AddNewline (1)

'	Call rtf.AppendText ("From Past "+ "  "+"Complaint  is Still Pending")

'	Call rtf.AddNewline (1)

	Call rtf.AppendText ("Please Find Out the Status OF the Complaint  As early As possible")

	Call rtf.AddNewline (3)

	style.Italic=True

	style.NotesColor =COLOR_RED

	Call rtf.AppendStyle(Style)

	Call rtf.AppendDocLink (doc,"")

	Call rtf.AppendText ("<==Click Here To Open The Document Details..")

	Call rtf.AddNewline (1)

	style.Bold =True

	Style.NotesFont = FONT_COURIER

	style.NotesColor =COLOR_BLACK

	Call rtf.AppendStyle(Style)

	Call rtf.AppendText ("%-------------------------------------------------------------------------------------%")

	Call rtf.AddNewline (4)

	style.Bold =True

	style.NotesColor =COLOR_BLUE

	Call rtf.AppendStyle(Style)

	Call rtf.AppendText ("Thanks & Regards")

	Call rtf.AddNewline (1)

	Call rtf.AppendText (doc.txt_cdept(0)+"  "+"Department")

	Call rtf.AddNewline (1)

	Call rtf.AppendText (doc.txt_cloc(0)+"  "+"Location")

'end escalation mailing code

'bcc mails for previous levels and requestor..

	Stop

'end bcc mails for previous levels and requestor..

	If test1=currentdate And doc.txt_status(0)<>"Closed" Then

		maildoc.form="memo"

		maildoc.subject=doc.txt_cloc(0)+"  "+ "Location "+"Ticket "+" "+doc.txt_isnum(0)+" "+"is Still Pending"

		If keys(2) <>"" Then

			maildoc.sendto=keys(2)

			

		End If

	End If

	

	If level3date=currentdate And status<>"Closed" Then

		maildoc.form="memo"

		maildoc.subject=doc.txt_cloc(0)+"  "+ "Location "+"Ticket "+" "+doc.txt_isnum(0)+" "+"is Still Pending"

		If keys(3) <>"" Then

			maildoc.sendto=keys(3)

		End If

	End If

	If level4date=currentdate And status<>"Closed" Then

		maildoc.form="memo"

		maildoc.subject=doc.txt_cloc(0)+"  "+ "Location "+"Ticket "+" "+doc.txt_isnum(0)+" "+"is Still Pending"

		If keys(4) <>"" Then

			maildoc.sendto=keys(4)

		End If

	End If

	

	If level5date=currentdate And status<>"Closed" Then

		maildoc.form="memo"

		maildoc.subject=doc.txt_cloc(0)+"  "+ "Location "+"Ticket "+" "+doc.txt_isnum(0)+" "+"is Still Pending"

		If keys(5) <>"" Then

			maildoc.sendto=keys(5)

		End If

	End If

	maildoc.Send (0)

	Set doc=view.GetNextDocument (doc)

Wend

End Sub

Subject: RE: mailing problem

Hi reddy.I just take a look to your code, and i think that you can try this.

In this line :

If If level5date=currentdate And status<>“Closed” Then

you are asking for a no declared and intialized variable…

You are append lines to the rtm item in the middle of the while statement … maybe you could do part of it outside of the while or initilize the body item each time, i think that this make a duplicated body to send the second time, the third… you know?.