Here is the code snippet.
Expand|Select|Wrap|Line Numbers
- <?php
- ---some code here --
- $session_notes = new COM("Lotus.NotesSession");
- $session_notes->Initialize("<password>");
- print "Current user: ".$session_notes->CommonUserName . "\n\n";
- $db = $session_notes->getDatabase( "", "Test.nsf" ) or die("Couldn't get database");
- $session_notes -> ConvertMime = FALSE;
- $my_stream = $session_notes -> CreateStream();
- $email_object = $db -> CreateDocument();
- $email_object ->ReplaceItemValue("Form","Memo");
- $body = $email_object -> CreateMIMEEntity();
- $bodyHeader = $body -> CreateHeader("Content-Type");
- $bodyHeader -> SetHeaderVal("multipart/mixed");
- $bodyHeader = $body -> CreateHeader("Subject");
- $bodyHeader -> SetHeaderVal("MIME Message");
- $bodyHeader = $body -> CreateHeader("To");
- $bodyHeader -> SetHeaderVal("madmak@foo.com");
- // problem with this line
- $child = $body -> createChildEntity();
- $my_stream -> WriteText("<html>This is the first child</html>");
- $child -> SetContentFromText($my_stream, "text/plain", ENC_NONE);
- $my_stream -> truncate();
- $child = $body -> createChildEntity();
- $my_stream -> WriteText("<html>This is the second child</html>");
- $child -> SetContentFromText($my_stream, "text/plain", ENC_NONE);
- $email_object -> Send(False);
- $session_notes -> ConvertMime = TRUE;
- ?>
Expand|Select|Wrap|Line Numbers
- Fatal error: Uncaught exception 'com_exception' with message 'Parameter -1: Type
- mismatch.
- ' in C:\Mailing\testmail.php:33
- Stack trace:
- #0 C:\Mailing\testmail.php(33): variant->createChildEntity()
- #1 {main}
- thrown in C:\Mailing\testmail.php on line 33
Also, the other question that I have is what is the difference between creating an object of type "Lotus.NotesSession" and "Notes.NotesSession".
Thanks in advance..