Skip to main content

Email type not set outlook SMTP

1 reply [Last post]
carthikn
Offline
Joined: 2008-09-27

Hi,

How to set the email type for outlook, I have to send the mail through outlook. If I compile the code it's attaching the file, to address, Bcc, Ccc but these address are set as email type. How to resolve this problem please help me to do. If anybody have the example code please send to me

Thanking you

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ihor42
Offline
Joined: 2009-09-23

as og jdic version 0.9.5 this has not been fixed yet. The solution to this problem has been outlined in http://forums.java.net/jive/thread.jspa?messageID=353668.
The file needed to be fixed is WinAPIWrapper.cpp. Here is the piece of code that needs to be changed:
...
for(int i = 0; i < toLen; i ++) {
jstring to = (jstring) env->GetObjectArrayElement(toArray, i);
if (to) {
char * temp = jstringToUnicode(env, to);
char * buffer = (char *) malloc(strlen(temp) + sizeof("SMTP:")); //fix
strcpy(buffer, "SMTP:"); //fix
strcat(buffer, temp); //fix
recipSend[msgSend.nRecipCount].lpszName = temp;
recipSend[msgSend.nRecipCount].lpszAddress = buffer; //fix
recipSend[msgSend.nRecipCount].ulRecipClass = MAPI_TO;
msgSend.nRecipCount ++;
}
}

for(i = 0; i < ccLen; i ++) {
jstring cc = (jstring) env->GetObjectArrayElement(ccArray, i);
if (cc) {
char * temp = jstringToUnicode(env, cc);
char * buffer = (char *) malloc(strlen(temp) + sizeof("SMTP:")); //fix
strcpy(buffer, "SMTP:"); //fix
strcat(buffer, temp); //fix
recipSend[msgSend.nRecipCount].lpszName = temp;
recipSend[msgSend.nRecipCount].lpszAddress = buffer; //fix
recipSend[msgSend.nRecipCount].ulRecipClass = MAPI_CC;
msgSend.nRecipCount ++;
}
}

for(i = 0; i < bccLen; i ++) {
jstring bcc = (jstring) env->GetObjectArrayElement(bccArray, i);
if (bcc) {
char * temp = jstringToUnicode(env, bcc);
char * buffer = (char *) malloc(strlen(temp) + sizeof("SMTP:")); //fix
strcpy(buffer, "SMTP:"); //fix
strcat(buffer, temp); //fix
recipSend[msgSend.nRecipCount].lpszName = temp;
recipSend[msgSend.nRecipCount].lpszAddress = buffer; //fix
recipSend[msgSend.nRecipCount].ulRecipClass = MAPI_BCC;
msgSend.nRecipCount ++;
}
}
...

I can't recompile jdic.dll as I don't have MSVC++ 6.0 Pro. 6.0. Can someone from this project implement the above fix and issue the updated version of jdic?

Thanks,
Ihor