Trying to put attachments on CDO Messages
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   matthew_smith
Posted On:   Thursday, June 27, 2002 12:50 AM

I'm currently trying to send emails using the CDO components. I can get the code to compile, but I run it I get a crash. After debug as much as I could, the crash is occuring when I make the call : attachment->ReadFromFile(absPath); Does anyone have any idea ?? Current CDO version is 1.2 JNIEXPORT jboolean JNICALL Java_JavaCDO_setMessageAttachment (JNIEnv *env, jobject, jstring fileName, jstring attach) { if (aMessagePtr == NULL) { return false; } AttachmentsPtr attachments = aMessagePtr->Attachments; AttachmentPtr attachment = attachments->Add(); CString absPath1 = env->GetStri   More>>

I'm currently trying to send emails using the CDO components. I can get the code to compile, but I run it I get a crash.

After debug as much as I could, the crash is occuring when I make the call :


attachment->ReadFromFile(absPath);



Does anyone have any idea ??


Current CDO version is 1.2

			

JNIEXPORT jboolean JNICALL Java_JavaCDO_setMessageAttachment (JNIEnv *env, jobject, jstring fileName, jstring attach)
{
if (aMessagePtr == NULL)
{
return false;
}

AttachmentsPtr attachments = aMessagePtr->Attachments;

AttachmentPtr attachment = attachments->Add();

CString absPath1 = env->GetStringUTFChars(fileName,0);

attachment->Name = env->GetStringUTFChars(attach,0);
attachment->Type = (long)CdoFileData;
attachment->Position = 0L;

_variant_t absPath(absPath1);

printf("%S",absPath.bstrVal);

attachment->ReadFromFile(absPath);

env->ReleaseStringUTFChars(fileName,NULL);
env->ReleaseStringUTFChars(attach,NULL);

attachments = NULL;

return true;
}

   <<Less
About | Sitemap | Contact