07-15-2009 11:05 AM
I am getting an runtime error -6577 (0xffffe64f) "An invalid object handle was passed to the LabWindows/CVI .NET Library" when I try to execute the following function:
void SendMail(void)
{
int iLocalFail;
const char *caMessage;
System_Net_Mail_SmtpClient smtpClientHandle;
smtpClientHandle = 0;
iLocalFail = System_Net_Mail_SmtpClient__Create_2(&smtpClientHandle, "smtp.us.lmco.com", 993, 0);
caMessage = CDotNetGetErrorDescription (iLocalFail);
CDotNetDiscardHandle(smtpClientHandle);
}
Defining smtpClientHandle anyother way other than System_Net_Mail_SmtpClient causes a complier error.
I am trying to use the System_Net_Mail_SmtpClient because InetSendMail is getting a "Error in sending mail" and I think our smtp server needs SSL enable.
Solved! Go to Solution.
07-15-2009 11:35 AM
The following are the includes for the file.
#include <cvidotnet.h>
#include "System.h"
#include <cvintwrk.h>
#include "toolbox.h"
#include <formatio.h>
#include <userint.h>
#include <utility.h>
#include <ansi_c.h>
#include <gpib.h>
07-16-2009 10:03 AM
It may be because you did not call Initialize_System to initialize the System assembly. The following does not return errors for me:
#include <system20.h>
void main(void)
{
System_Net_Mail_SmtpClient client;
int error;
error = Initialize_System();
error = System_Net_Mail_SmtpClient__Create_2(&client, "smtp-server.tx.rr.com", 25, 0);
error = CDotNetDiscardHandle(client);
error = Close_System();
}
07-16-2009 10:39 AM
Thanks, that fixed it.
02-06-2024 05:04 PM
Does anyone has "system20.h" file that you can upload to this platform?
Thank you in advanced.