I am using Lotus Script to send out an email, but when I point it to an address outside my domain, it wont get sent. When I use an internal address it works. Can anyone help?Here is the code:
Sub Initialize
On Error Goto errHandle
Print "BiDailyReminderEmailAssessorSalary-LS began"
Dim Session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim agent As NotesAgent
Set agent = session.CurrentAgent
Dim richStyle As NotesRichTextStyle
Dim vwSalaryStmt As NotesView
Set vwSalaryStmt = db.GetView( "vwLookupSubmittedSalary4Assessor-Agent" )
Call vwSalaryStmt.Refresh
Dim vwMillMast As NotesView
Set vwMillMast = db.GetView( "vwLookupMillageMaster" )
Dim sDoc As NotesDocument
Dim sDocTemp As NotesDocument
Dim millMast As NotesDocument
Dim mailDoc As New NotesDocument(db)
Dim profileDoc As NotesDocument
Set profileDoc = db.GetProfileDocument( "Config" )
Dim vNotify As Variant
Dim vCC As Variant
Dim tempString As String
Dim sStatus As String
sStatus = ""
vCC = profileDoc.CCTo
mailDoc.Form = "Memo"
mailDoc.CopyTo = vCC
Set sDoc = vwSalaryStmt.GetFirstDocument()
While Not(sDoc Is Nothing)
Set sDocTemp = vwSalaryStmt.GetNextSibling(sDoc)
tempString = Trim(sDoc.ParishKey(0))
Set millMast = vwMillMast.GetDocumentByKey(tempString,True)
If Not(millMast Is Nothing) Then
vNotify = millMast.email(0)
’ vNotify = “ddavidson4@yahoo.com”
’ vNotify = “ddavidson@lla.state.la.us”
'******************************************************
’ Dim names(1) As String
’ names(0) = “ddavidson4@yahoo.com”
’ names(1) = “ddavidson@lla.state.la.us”
’ mailDoc.SendTo = names()
mailDoc.SendTo = vNotify
mailDoc.recipients = vNotify
mailDoc.INETSendTo = vNotify
mailDoc.INETFrom = profileDoc.Principal
mailDoc.SentBy = profileDoc.SentBy
mailDoc.SMTPOriginator = profileDoc.Principal
mailDoc.Principal = profileDoc.Principal
mailDoc.ReplyTo = profileDoc.ReplyTo
mailDoc.AgentSource = agent.Name
sStatus = ""
sStatus = sDoc.Status(0)
Select Case sStatus
’ Case “Revise”
’ mailDoc.Subject = “An LLA Reassessment has been marked for revision for tax " + sDoc.Tax(0) + " (” + sDoc.MillageKey(0) + ") "
’ mailDoc.Body = “Please review and revise the LLA Reassessment for tax " + sDoc.Tax(0) + " (” + sDoc.MillageKey(0) + ") " + Chr(13) +_
’ "You can login here: " + profileDoc.URL(0) + Chr(13) + Chr(13) + _
’ “________________________”+ Chr(13) + Chr(13) + _
’ "Note: This is an automatic agent set to execute hourly. This message is from " + db.Title + " on " + db.Server + “.” + Chr(13)
Case "Approved"
mailDoc.Subject = "Assessor's Salary Statement for " & Cstr(sDoc.Year(0)) & " has been reviewed and approved"
mailDoc.Body = "The Assessor's Salary Statement for " + Cstr(sDoc.Year(0)) + " has been reviewed and approved by the Office of the Legislative Auditor." + Chr$(13) + Chr$(13) + _
"You can login here: " + profileDoc.URL(0) + Chr(13) + Chr(13) + _
"________________________"+ Chr(13) + Chr(13) + _
"Note: This is generated by an automatic agent. This message is from " + db.Title + " on " + db.Server + "." + Chr(13)
Case Else
mailDoc.Subject = "This is an error - Please ignore! " + sDoc.Year(0) + " (" + sDoc.ParishKey(0) + ") "
mailDoc.Body = "This is an error " + sDoc.Year(0) + " (" + sDoc.ParishKey(0) + ") " + Chr(13) +_
"________________________"+ Chr(13) + Chr(13) + _
"Note: This is generated by an automatic agent. This message is from " + db.Title + " on " + db.Server + "." + Chr(13)
End Select
sDoc.NotifiedAssessor = Now
tempString = sDoc.AgentComment(0)
sDoc.AgentComment = tempString + Chr(13) + "Assessor Notify Processed on: " + Cstr(Now)
Call mailDoc.Send( False )
Else
tempString = sDoc.AgentComment(0)
sDoc.AgentComment = tempString + Chr(13) + "Assessor Notify Couldn't find millMast on: " + Cstr( Now)
End If
Call sDoc.Save( True, True )
Set sDoc = sDocTemp
Set sDocTemp = Nothing
Wend
Print "BiDailyReminderEmailAssessorSalary-LS completed"
Exit Sub
errHandle:
Dim ErrSession As New NotesSession
Dim Errdb As notesdatabase
Set Errdb = ErrSession.CurrentDatabase
Dim errSendTo (1 To 3) As String
Dim ErrMail As New NotesDocument(Errdb)
ErrMail.SendTo = profileDoc.SendTo
ErrMail.CopyTo = profileDoc.CCTo
ErrMail.Subject = "Error in Salary Statement Assessor Notification email Agent: " & "Error #" & Str$(Err) & " - " & Error$
ErrMail.Body = "Error in: " & Errdb.Title & " | "
Call ErrMail.Send(False)
Err = 0
End Sub