Save & Mail / Ambiguous lookup issue

I have a form with a “Save & Mail” action with the code below. Users are receiving the "Error 4295 on line 49 in function SENDMAIL: Unable to send mail, multiple matches found in Name & Address Book(s)

I am looking to see if someone can help revise the code?

Action:

If ValidateTaskFields( uidoc , doc.Type(0), doc.GetFirstItem(“Assignee”) ) = True Then

	'we can open the mail dialog and send the mail

	Call SendMail(uidoc, inputtxt, SaveAndMailRecipients)

	'stop here if user cancelled or entered no names in the SendMail routine

	If SaveAndMailRecipients = "Cancelled" Then Exit Sub

	'otherwise, pass  the "sent to" line to QuerySave using the SendMailOutput field

	Call uidoc.FieldSetText("SendMailOutput", SaveAndMailRecipients)

	Call uidoc.Refresh

	Call uidoc.Save

Script:

Option Public

Option Declare

Use “OpenLogFunctions”

Use “LS.utilities.BE.6.Extended.Database”

Sub Initialize

'Save & Mail.  Send email notification with doclink to designated individuals.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim newDoc As NotesDocument     ' the mail message

Dim rtitem As NotesRichTextItem

Dim doc As NotesDocument             ' the current document to which the link points

Dim recipients( 1 To 3 ) As String

Dim SaveAndMailRecipients As String

Dim fname As String

Dim label As String

Dim bodytext As String

Dim picklist As Variant

Dim continue As Variant

Dim inputtxt As String

Dim X As Variant

Dim TypeTask As String

Dim itemInput As NotesItem

Dim itemAssignee As NotesItem

Dim user As String

Dim whstring As String

Dim dateTime As New NotesDateTime( "" )



Set db = session.CurrentDatabase

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.Document



Set itemInput = doc.GetFirstItem( "Input" )

Call uidoc.Refresh

Call uidoc.Save

user = session.CommonUserName

Call dateTime.SetNow



TypeTask = uidoc.FieldGetText("Type")

Set itemAssignee = doc.GetFirstItem( "Assignee" )

If ValidateTaskFields(uidoc, TypeTask, itemAssignee ) = False Then

	continue = False

	Exit Sub ' we don't want to proceed further if field validation fails

Else  ' proceed with mail send dialog

	If workspace.DialogBox("DialogSaveAndMail", True, True, False, False, False, False, "Save & Mail to...", , True) Then

		

		If ( itemInput.text	 <> "" ) Then

			doc.WorkHistoryText = dateTime.LSLocalTime & " -- " & user & SaveAndMailRecipients & Chr(13) & Chr(10) & itemInput.text

			doc.InputHistory = doc.InputHistory(0) & Chr(13) & Chr(10) & doc.WorkHistoryText(0) & Chr(13) & Chr(10) & "_____________________________________" & Chr(13) & Chr(10)

			doc.Input = ""

			SaveAndMailRecipients = ""

		Else

			If SaveAndMailRecipients = "" Then

				doc.InputHistory = doc.InputHistory(0)

			Else

				whstring = dateTime.LSLocalTime & " -- " & user & SaveAndMailRecipients

				doc.InputHistory = doc.InputHistory(0) & Chr(13) & Chr(10) & whstring & Chr(13) & Chr(10) & "_____________________________________" & Chr(13) & Chr(10)

				doc.Input = ""

				SaveAndMailRecipients = ""

			End If

		End If

		

		Set newDoc = New NotesDocument( db )

		Set rtitem = New NotesRichTextItem( newDoc, "Body" )

		

		label = db.Title & ": " & doc.Type( 0 ) & " # " & doc.PMISTask( 0 )

		newDoc.SendTo = doc.SaveAndMailTo

		newDoc.Subject = label & " (" & Left$(doc.Description(0), 100) & "... )"

		

		bodytext = label  'could include more info from Task doc here if we wanted, someday

		

		Call rtitem.AppendText( label & "  --> ")

		Call rtitem.AppendDocLink( doc, label )

		

	'capture who sent to and add to Work History in QuerySave

		SaveAndMailRecipients = "   (sent to: " & Implode(doc.SaveAndMailTo, ", ") & ")"

		

		Call newDoc.Send( False )

	'If user has [HelpDesk] role, don't show msgbox

		X = Evaluate( | @IsMember("[HelpDesk]" ; @UserRoles) |, doc )

		If X(0) <> 1 Then

			Msgbox "Message Sent to: " & Implode(doc.SaveAndMailTo, ", ") & ".", 64, "Save & Mail"

		End If

		doc.SaveAndMailToChecked = ""   'from dialog box

		doc.SaveAndMailToAnyone = ""    'from dialog box

		Call LogEvent("Message sent: " + label, SEVERITY_LOW, Nothing)		

		Call doc.Save(True,True,True)

		

'If user has [TaskTimeLog] role, open a new Time Log document

		X = Evaluate( | @IsMember("[TaskTimeLog]" ; @UserRoles) |, doc )

		If X(0) = 1 Then

			If ValidateForTimeLog(uidoc) Then

				Call NewTimeLog(uidoc, itemInput.text)

			End If

		End If

		

		Call uidoc.Close

	End If

End If

End Sub

Thanks in advance!!

Subject: Save & Mail / Ambiguous lookup issue

Did anything change?

I would step thru debugger and check what you are passing in is not a single string of multiple addresses. Also I had luck in appending the @ and the domain name as address book might have duplicates.

Subject: RE: Save & Mail / Ambiguous lookup issue

Yes we had a change: We migrated from Notes e-mail to Outlook. It was working fine before.

Subject: RE: Save & Mail / Ambiguous lookup issue

Like I said I have luck in appending @domain to the address. Perhaps you need to create a quick function in the code that you pass in the notes name and it return the internet address based on a lookup to the nab and send the emails using the internet address.