473,492 Members | 4,301 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

multipart message in PHP to send mail via lotus notes

2 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. ---some code here -- 
  3.  
  4. $session_notes = new COM("Lotus.NotesSession"); 
  5.  
  6. $session_notes->Initialize("<password>"); 
  7. print "Current user: ".$session_notes->CommonUserName . "\n\n"; 
  8.  
  9. $db = $session_notes->getDatabase( "", "Test.nsf" ) or die("Couldn't get database"); 
  10. $session_notes -> ConvertMime = FALSE; 
  11.  
  12. $my_stream = $session_notes -> CreateStream(); 
  13.  
  14. $email_object = $db -> CreateDocument(); 
  15.  
  16. $email_object ->ReplaceItemValue("Form","Memo"); 
  17.  
  18. $body = $email_object -> CreateMIMEEntity(); 
  19.  
  20. $bodyHeader = $body -> CreateHeader("Content-Type"); 
  21.  
  22. $bodyHeader -> SetHeaderVal("multipart/mixed"); 
  23.  
  24. $bodyHeader = $body -> CreateHeader("Subject"); 
  25.  
  26. $bodyHeader -> SetHeaderVal("MIME Message"); 
  27.  
  28. $bodyHeader = $body -> CreateHeader("To"); 
  29.  
  30. $bodyHeader -> SetHeaderVal("madmak@foo.com"); 
  31.  
  32. // problem with this line
  33. $child = $body -> createChildEntity();
  34.  
  35. $my_stream -> WriteText("<html>This is the first child</html>"); 
  36.  
  37. $child -> SetContentFromText($my_stream, "text/plain", ENC_NONE); 
  38.  
  39. $my_stream -> truncate(); 
  40.  
  41. $child = $body -> createChildEntity(); 
  42.  
  43. $my_stream -> WriteText("<html>This is the second child</html>"); 
  44.  
  45. $child -> SetContentFromText($my_stream, "text/plain", ENC_NONE); 
  46.  
  47. $email_object -> Send(False); 
  48.  
  49. $session_notes -> ConvertMime = TRUE; 
  50.  
  51. ?> 
I get the following error when I run this code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Fatal error: Uncaught exception 'com_exception' with message 'Parameter -1: Type 
  3. mismatch. 
  4. ' in C:\Mailing\testmail.php:33 
  5. Stack trace: 
  6. #0 C:\Mailing\testmail.php(33): variant->createChildEntity() 
  7. #1 {main} 
  8. thrown in C:\Mailing\testmail.php on line 33 
  9.  
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..
May 14 '07 #1
2 6292
pbmods
5,821 Recognized Expert Expert
Heya madmak. Welcome to TSDN!

I get the following error when I run this code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Fatal error: Uncaught exception 'com_exception' with message 'Parameter -1: Type 
  3. mismatch. 
  4. ' in C:\Mailing\testmail.php:33 
  5. Stack trace: 
  6. #0 C:\Mailing\testmail.php(33): variant->createChildEntity() 
  7. #1 {main} 
  8. thrown in C:\Mailing\testmail.php on line 33 
  9.  
Is C:\Mailing\testmail.php one of your scripts? What are you trying to do on or around line 33 that's throwing the exception?
May 15 '07 #2
madmak
2 New Member
Hi All

testmail.php is the script for which the code is posted.
In line 33 ($child = $body -> createChildEntity();) I am trying to create a mime child entity which will hold the attachment in the mail message.
May 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
19306
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
5
4989
by: NickBlooruk | last post by:
Hello, I have successfully linked a Lotus Notes server to our SQL Server database using an ODBC connection. This works fine when wanting to select records eg openquery(LOTUSNOTES2, 'select *...
10
4219
by: hrishy | last post by:
Hi I have heard rumors that Lotus notes would be moving to db2 as the datastore..would that mean db2 for windows and Linux have a shot in its arm and become as pervasive as oracle and ms-sql...
0
2402
by: Elankathir S.N. | last post by:
Hi All, I’m using ASP with VBScript…and I need to send mails using Lotus Notes Mail Server (IBM). How to communicate to the Lotus Notes Server and send mails??? Thanks, - Elan
4
6051
by: navyliu | last post by:
I want send Lotus Notes Email automatic in my Application.I googled this topic but I can't find the solution. Does anyone have ever use this function?Can you give me some advice? Thanks a lot!
0
2764
by: sachintandon | last post by:
Hello all, Thanks in advance for your help I have a problem in sending emails, my requirement is to send multipart alternative emails with attachments, I'm able to send text with attachments or...
3
2127
by: Eric Layman | last post by:
Hi, Can asp.net 1.1's Mail object autheticate user information via Lotus Notes? For IIS's built in SMTP, it can be done via CDO SYS: ...
3
8935
by: Mike D | last post by:
OS: Windows XP Professional Access 2003 Lotus Notes 7 I am trying to send a email message from Access that will have 2 attachments that are excel versions of 2 separate queries. I can send 1...
0
1574
by: Kristoph | last post by:
Hello, I would like to send an Access report as text in the body of a Lotus Notes email. Currently I am using DoCmd.SendObject which sends the report as a text attachment just great! But,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.