PHP and lotus notes email query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
madMak
Forum Newbie
Posts: 1
Joined: Thu May 10, 2007 2:44 pm

PHP and lotus notes email query

Post by madMak »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


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: Select all

<?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");

$child = $body -> createChildEntity(); ----------------------------------------------->>> problem with this line

$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;

?>

I get the following error when I run this code.

Fatal error: Uncaught exception 'com_exception' with message 'Parameter -1: Type
mismatch.
' in C:\Mailing\testmail.php:42
Stack trace:
#0 C:\Mailing\testmail.php(42): variant->createChildEntity()
#1 {main}
thrown in C:\Mailing\testmail.php on line 42


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.NotesSession" and "Notes.NotesSession".

Thanks in advance..


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply