I have a problem with a LS agent which sends a notification e-mail. Users who have the mail preference for exhaustive directory lookup enabled are receiving the 4295 error (ambiguous name).To get around this problem I am trying to place the notification message directly in the server mail.box DB. The code below works on my local PC, but not on the server. I have run the code through the debugger and do not receive any errors. I have manager ACL rights on mail.box.
'<> values are for demonstration
Dim session As New NotesSession
Dim doc As NotesDocument
Dim db As New NotesDatabase( "", "" )
Call db.Open( "<Server Name>", "mail.box" )
On Error Goto Errhandle
If db.IsOpen Then
Set doc = New NotesDocument ( db )
doc.Form = "Memo"
doc.SendTo="<recipient name>"
doc.From = "<Test Agent>"
doc.Subject=" Testing mail agent"
doc.Body="test"
Call doc.Save( True, True )
End If
Exit Sub
Subject: Placing memo directly in mail.box
Directly writing documents to the mail.box should be avoided. Why don’t you fix the actual problem? If the string you’re using as the SendTo value is ambiguous at the client, do you think it will be less so to the server router? What happens if it’s not?
I’d clean up the SendTo value so that it explicitly names the intended recipient (by specifying the domain perhaps?) rather than try to subvert the system.
Subject: RE: Placing memo directly in mail.box
What I really need is to be able to call the ambiguous name dialog box and let the user select the correct name. I had searched the forum, found the same problem reported many times and the consensus seems to be to use the direct to mail.box trick (even though it is bad practice). The issue seems to be that some users have ancient local copies/replicas of the NAB and/or they have entered names in the personal NAB that match names in the corporate NAB.
Subject: RE: Placing memo directly in mail.box
You could use evaluate with @namelookup([EXHAUSTIVE]) on the names in the SendTo list and present the possible results to the user as a promptlist. This would mimic the ambiguous name dialog.
Subject: RE: Placing memo directly in mail.box
Thanks for the suggestions
Subject: RE: Placing memo directly in mail.box
As Jerry suggests, adding your mail domain to the end of the recipient’s name should supress the error and allow the mail to be sent to mail.box, essentially the same result you would achieve by doing it programatically.
doc.SendTo = “John Doe@ACME” or
doc.SendTo = & “@ACME”
Subject: Placing memo directly in mail.box
Hi Frank,
to get your script working when sending mails directly into the mail.box of the server you need some more fields.
These fields are needed for every mail you send.
sendto
inetsendto
from
inetfrom
posteddate (now)
copyto (optional)
inetcopyto (optional)
blindcopyto (optional)
inetcopyto (optional)
Subject (optional)
Body (optional)
recipients (MANDATORY FIELD ! all names used in all fields … sendto: copyto: blindcopyto)
Hope this helps !
regards,
Peter