Hi, I am a noob with PHP and need some asistance regarding PHP and lotus notes. I am trying to create a multipart message in PHP to send mail via lotus notes.
Here is the code snippet.
[CODE=php]<?php
---some code here --
$session_notes = new COM("Lotus.Note sSession");
$session_notes->Initialize("<p assword>");
print "Current user: ".$session_note s->CommonUserNa me . "\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 ->ReplaceItemVal ue("Form","Memo ");
$body = $email_object -> CreateMIMEEntit y();
$bodyHeader = $body -> CreateHeader("C ontent-Type");
$bodyHeader -> SetHeaderVal("m ultipart/mixed");
$bodyHeader = $body -> CreateHeader("S ubject");
$bodyHeader -> SetHeaderVal("M IME Message");
$bodyHeader = $body -> CreateHeader("T o");
$bodyHeader -> SetHeaderVal("m admak@foo.com") ;
// problem with this line
$child = $body -> createChildEnti ty();
$my_stream -> WriteText("<htm l>This is the first child</html>");
$child -> SetContentFromT ext($my_stream, "text/plain", ENC_NONE);
$my_stream -> truncate();
$child = $body -> createChildEnti ty();
$my_stream -> WriteText("<htm l>This is the second child</html>");
$child -> SetContentFromT ext($my_stream, "text/plain", ENC_NONE);
$email_object -> Send(False);
$session_notes -> ConvertMime = TRUE;
?> [/CODE]
I get the following error when I run this code.
Can somebody help me out with this.
Also, the other question that I have is what is the difference between creating an object of type "Lotus.NotesSes sion" and "Notes.NotesSes sion".
Thanks in advance..
Here is the code snippet.
[CODE=php]<?php
---some code here --
$session_notes = new COM("Lotus.Note sSession");
$session_notes->Initialize("<p assword>");
print "Current user: ".$session_note s->CommonUserNa me . "\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 ->ReplaceItemVal ue("Form","Memo ");
$body = $email_object -> CreateMIMEEntit y();
$bodyHeader = $body -> CreateHeader("C ontent-Type");
$bodyHeader -> SetHeaderVal("m ultipart/mixed");
$bodyHeader = $body -> CreateHeader("S ubject");
$bodyHeader -> SetHeaderVal("M IME Message");
$bodyHeader = $body -> CreateHeader("T o");
$bodyHeader -> SetHeaderVal("m admak@foo.com") ;
// problem with this line
$child = $body -> createChildEnti ty();
$my_stream -> WriteText("<htm l>This is the first child</html>");
$child -> SetContentFromT ext($my_stream, "text/plain", ENC_NONE);
$my_stream -> truncate();
$child = $body -> createChildEnti ty();
$my_stream -> WriteText("<htm l>This is the second child</html>");
$child -> SetContentFromT ext($my_stream, "text/plain", ENC_NONE);
$email_object -> Send(False);
$session_notes -> ConvertMime = TRUE;
?> [/CODE]
I get the following error when I run this code.
Code:
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.NotesSes sion" and "Notes.NotesSes sion".
Thanks in advance..
Comment