Everything about Domino, PHP and other programming languages

doc.Send versus doc.CopyToDatabase(serverOutbox) method

Ferdi Verlaan  February 22 2010 10:40:23 AM
Normally documents are mailed by 'doc.Send' class and method.
You can also use the doc.CopyToDatabase method. This method is very handy for scheduled or signed mail agents. In this way you always can alter the from and principal field. With the doc.Send method most of the time the current user will be replacing these values. With the mail.box method the principal and from fields remain the same.

This method works when the field note.Recipients is set to value X. Where "note" is the document to send and "X" is the e-mail address(es).

        Dim serverOutbox As NotesDatabase
        Set serverOutbox = New NotesDatabase( db.Server, "mail.box" )

        'Build a document ...

        'Copy this document to the server's outgoing mailbox.
        Call note.Save( True, True, True )
        Call note.CopyToDatabase(serverOutbox)

Comments

1Les Roy  05/16/2011 10:58:26 PM  doc.Send versus doc.CopyToDatabase(serverOutbox) method

I have been using this method successfully in a web app with Domino 7, but recently I upgraded to Domino 8 and now email is no longer sent.

I get "mail.box has not been opened yet" in the browser window, and in the server log I get "Error connecting to server blah: The server is not responding. The server may be down or you may be experiencing network problems. Contact your system administrator if this problem persists." The server it says it cannot connect to is itself.

The line of code that it fails on is when it tries to create a new document either via:

Dim newDoc As New NotesDocument(mailBox)

or creating the document in the current database (that works) and then doing a copy of the document to the mail.box instead, and that didn't help either.

The same application is also still on a Domino 7 server and it continues to function there.

Any ideas?

Thanks in advance.

2Ferdi Verlaan  03/19/2012 5:13:33 PM  doc.Send versus doc.CopyToDatabase(serverOutbox) method

Dear Les Roy,

a very very late response. We had some issues with spam on this blog...

Since you are using this method on the web, perhaps some right-management has been changed in D8? I'm not sure.

The error looks like to me that the mail.box database is not available for the current (logged in or anonymous user).

Things to check:

db.Server is returning the right result?

rights of the mail.box are correct?