Jaziar
asked on
Script Not Sending Email
Does anyone see a reason this script is not sending a email out. It has worked before, but today it is not working.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uiDoc As NotesUIDocument
Dim thisDoc As NotesDocument
Dim newDoc As NotesDocument
Dim varNewTo As Variant
Dim item As NotesItem
Dim session As New NotesSession
Dim view As NotesView
Dim pDoc As NotesDocument
Dim strServer As String
Dim strFilename As String
Dim rtItem As NotesRichTextItem
Set uiDoc = ws.CurrentDocument
Set thisDoc = uiDoc.Document
Set db = thisDoc.ParentDatabase
Dim strToName As String
Set newDoc = New NotesDocument(db)
Call thisDoc.CopyAllItems(newDo c, True)
varNewTo = ws.PickListStrings(PICKLIS T_NAMES, True)
k = Inputbox("Enter your comments")
Set item = newDoc.GetFirstItem("SendT o")
item.Values = varNewTo
'newDoc.SenderList = "Forwarded by " & session.CommonUserName & Chr$(13) & newDoc.SenderList(0)
newDoc.Subject = "Fw: " & thisDoc.Subject(0)
newDoc.FowardComments = k
Call newDoc.Send(True)
' Now, put a note in the original database indicating that the document was forwarded.
strServer = thisDoc.DatabaseServer(0)
strFilename = thisDoc.DatabaseName(0)
Set db = New NotesDatabase(strServer, strFilename)
Set view = db.GetView("2005\Actions")
Set pDoc = db.GetDocumentByUNID(thisD oc.SourceD ocument(0) )
Set rtItem = pDoc.GetFirstItem("Comment s")
strToName = StringReplace(item.Text, "CN=", "")
strToName = StringReplace(strToName, "/OU=Lex/O=Lexmark", "")
Call rtItem.AppendText("Forward ed to " & strToName & " by " & session.CommonUserName)
Call rtItem.AddNewLine(1)
Call rtitem.appendtext("Forward ed Comment: " & k)
Call rtItem.AddNewLine(1)
Call pDoc.Save(True, False)
Call uiDoc.Close(True)
End Sub
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim uiDoc As NotesUIDocument
Dim thisDoc As NotesDocument
Dim newDoc As NotesDocument
Dim varNewTo As Variant
Dim item As NotesItem
Dim session As New NotesSession
Dim view As NotesView
Dim pDoc As NotesDocument
Dim strServer As String
Dim strFilename As String
Dim rtItem As NotesRichTextItem
Set uiDoc = ws.CurrentDocument
Set thisDoc = uiDoc.Document
Set db = thisDoc.ParentDatabase
Dim strToName As String
Set newDoc = New NotesDocument(db)
Call thisDoc.CopyAllItems(newDo
varNewTo = ws.PickListStrings(PICKLIS
k = Inputbox("Enter your comments")
Set item = newDoc.GetFirstItem("SendT
item.Values = varNewTo
'newDoc.SenderList = "Forwarded by " & session.CommonUserName & Chr$(13) & newDoc.SenderList(0)
newDoc.Subject = "Fw: " & thisDoc.Subject(0)
newDoc.FowardComments = k
Call newDoc.Send(True)
' Now, put a note in the original database indicating that the document was forwarded.
strServer = thisDoc.DatabaseServer(0)
strFilename = thisDoc.DatabaseName(0)
Set db = New NotesDatabase(strServer, strFilename)
Set view = db.GetView("2005\Actions")
Set pDoc = db.GetDocumentByUNID(thisD
Set rtItem = pDoc.GetFirstItem("Comment
strToName = StringReplace(item.Text, "CN=", "")
strToName = StringReplace(strToName, "/OU=Lex/O=Lexmark", "")
Call rtItem.AppendText("Forward
Call rtItem.AddNewLine(1)
Call rtitem.appendtext("Forward
Call rtItem.AddNewLine(1)
Call pDoc.Save(True, False)
Call uiDoc.Close(True)
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is the agent running ? I mean is it processing the target documents?
I hav no idea why it doesn't work any more.
> Set item = newDoc.GetFirstItem("SendT
> item.Values = varNewTo
>
Why not just
newDoc.SendTo= varNewTo
And what's in the log about the agent or the mail? Did the agent do the lines after the Send?
Cheers!
Sjef