I have a script that will send an e-mail, but it was created with an older version (4.20.0.0) of kixtart and ran oulook 2000. It was running on a windows 2003 server
I now have the same version of wkix32.exe, and outlook 2010 on a windows 7 pro 32bit pc and I am trying to get this working with no luck. Debug did not help much.
This is the script as I have altered it:

 Code:
If Exist ("\\<server>\home\smc\creditlist\creditmgr.xls")

		SendEmail ("IT Department", "Test E-mail", "Reply if you receive this".)

Else
  
	SendEmail ("IT Department", "Test E-mail", "Reply if you receive this - ind bad".)
                 
EndIf 

Function SendEmail ($Recip, $Subject, $Text)

	;Session.Logon now uses the default MAPI profile as found in the registry.
	
If @INWIN = 2
	; Windows 98 profile
	
	$DefaultProfile = 
		ReadValue("HKEY_CURRENT_USER\Software\Microsoft\" +
			"Windows Messaging Subsystem\Profiles", "DefaultProfile")
     
Else
     ; Windows 2000 profile
                
	$DefaultProfile = 
		ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\" +
			"CurrentVersion\Windows Messaging Subsystem\Profiles", "DefaultProfile")
EndIf
			
	$Session = CreateObject("MAPI.Session")
	$Session.Logon($DefaultProfile)

	;Create the core MAPI objects--Message and Recipient

	$Message = $Session.Outbox.Messages.Add
	$Recipient = $Message.Recipients.Add
   
   ;Compose the message
   
   $Message.Subject = $Subject
   $Message.Text = $Text 
	
	;Translating email address so the '@' symbol doesn't confuse 
	;KiXtart as being a macro.This is better than having to remember
	;to Use '@@' in the Function argument, although either method will work.
	
	If InStr ($Recip, "<unknown:") <> 0
		
		$Recip = SubStr($Recip, 1, InStr($Recip, "<unknown:") - 1) + "@@" +  
					SubStr($Recip, InStr($Recip, "<unknown:") + 9, Len($Recip))
					
	EndIf	
	
	;Select recipient
	;	Note:	Recipient.Type values are as follows:
	;			1 = To
	;			2 = Cc
	;			3 = Bcc			
	
	$Recipient.Name = $Recip
	$Recipient.Type = 1
	$Recipient.Resolve
   
   ;Sending the message
   
   $Message.Send
   
   $Session.DeliverNow
   
   ;Disconnecting MAPI Session
   
   $Session.Logoff
   
   ;Object Cleanup
   
   $Recipient = 0
   $Message = 0
   $Session = 0

EndFunction    


I think the problem is that outlook 2000 invoked MAPI, but I don't know what 2010 uses.
If I cannot use outlook 2010, I will need to use 2007 and try again.
Thanks in advance.


Edited by Mart (2013-07-23 11:01 PM)
Edit Reason: Please use code tags when posting code.