Script Not Sending Email

Posted on 2005-04-14
Last Modified: 2013-12-18
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(newDoc, True)
      varNewTo = ws.PickListStrings(PICKLIST_NAMES, True)
      k = Inputbox("Enter your comments")      
      Set item = newDoc.GetFirstItem("SendTo")
      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(thisDoc.SourceDocument(0))
      Set rtItem = pDoc.GetFirstItem("Comments")
      strToName = StringReplace(item.Text, "CN=", "")
      strToName = StringReplace(strToName, "/OU=Lex/O=Lexmark", "")
      Call rtItem.AppendText("Forwarded to " & strToName & " by " & session.CommonUserName)
      Call rtItem.AddNewLine(1)
      Call rtitem.appendtext("Forwarded Comment:  " & k)
      Call rtItem.AddNewLine(1)
      Call pDoc.Save(True, False)
      Call uiDoc.Close(True)
End Sub
Question by:Jaziar
    LVL 46

    Expert Comment

    by:Sjef Bosman
    Hi Jaziar,

    I hav no idea why it doesn't work any more.

    >   Set item = newDoc.GetFirstItem("SendTo")
    >      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?

    LVL 14

    Accepted Solution

    As we all said earlier , do a error trapping, it will help you in debugging . Also it wud be data issue:

    Sub Click(Source As Button)
    on error goto jaziar

    last line shd be
    exit sub
    msgbox "error occurred on line number " & erl & "error is " & error
    exit sub
    end sub
    LVL 1

    Expert Comment

    Is the agent running ? I mean is it processing the target documents?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
      In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now