SetBodyHTML problem

64 views
Skip to first unread message

Yuriy Pavlovsky

unread,
Mar 18, 2010, 8:47:05 AM3/18/10
to Nektra OEAPI Support
Hello.
I'm developing c++ dll using OEAPI Enterprise edition v3.2.3 under
Vista x86.
On new message creation event, this code is executed:

CComPtr<IOEMsgWnd> wnd = m_oeapi->GetMsgWnd(msgId);
BSTR b = SysAllocString(L"<A href=\"google.com\">google</A>");
wnd->SetBodyHTML(&b);
SysFreeString(b);

But in message there is only underlined "google", without link itself.
Using VB demo, ive inspected message, and found that its body contains
only this :

<A href="">google</A>

If i add some url to href and press "Set Body", nothing changes, in
fact, it is still without any url in href.

Same happens when i try to add <IMG> tags - i receive empty src, no
pictures displayed.

Someswara Poduri

unread,
Mar 18, 2010, 2:03:26 PM3/18/10
to nektra...@googlegroups.com

hey
I am Trying to write a pluggin where I am not able to succeed to call openmessage(msid,IMIME,**mime); Any pointers how to handle this on Vista . ? I am getting errors on Vista only.


Thanks
Somu

<A href="">google</A>

--
You received this message because you are subscribed to the Google Groups "Nektra OEAPI Support" group.
To post to this group, send email to Nektra...@googlegroups.com
To unsubscribe from this group, send email to Nektra-OEAPI...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Nektra-OEAPI?hl=en

--
http://www.nektra.com

..

Nektra OEAPI Support

unread,
Mar 19, 2010, 10:51:35 AM3/19/10
to nektra...@googlegroups.com
Hi Somu,

Questions about the source code are handled directly through email, we
have already sent you an answer.

Thank you for contacting Nektra's OEAPI Support.

Regards,

Scott

--
Nektra Advanced Computing
http://www.nektra.com

Nektra OEAPI Support

unread,
Mar 19, 2010, 11:57:52 AM3/19/10
to nektra...@googlegroups.com
Hi Yuriy,

Try adding http:// to your href, like this:
BSTR b = SysAllocString(L"<A href=\"http://google.com\">google</A>");
A note, just in case,  if you want to set the body of the new message window only, you could make sure that the window style is "OE_MSG_SEND_WND".
Regards,

Federico

--
Nektra Advanced Computing
http://www.nektra.com

Yuriy Pavlovsky

unread,
Mar 23, 2010, 8:34:03 AM3/23/10
to Nektra OEAPI Support, melko...@gmail.com
Hi, Federico,
I've done what you said, but nothing changed, href still apears empty
in body.

My code:
BSTR b = SysAllocString(L"<A href=\"http://google.com\">second google</
A>");

Inspecting body:
<A href="">second google</A>


On Mar 19, 5:57 pm, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:
> Hi Yuriy,
> Try addinghttp://to your href, like this:BSTR b = SysAllocString(L"<A href=\"http://google.com\">google</A>");A note, just in case,  if you want to set the body of the new message window only, you could make sure that thewindow styleis "OE_MSG_SEND_WND".Regards, Federico -- Nektra Advanced Computinghttp://www.nektra.com

Nekrasov

unread,
Mar 23, 2010, 12:14:34 AM3/23/10
to nektra...@googlegroups.com
Thank you.

Hou check, there is new messages not starting OE?

> --
> You received this message because you are subscribed to the Google Groups
> "Nektra OEAPI Support" group.
> To post to this group, send email to Nektra...@googlegroups.com
> To unsubscribe from this group, send email to
> Nektra-OEAPI...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/Nektra-OEAPI?hl=en
>
> --
> http://www.nektra.com
>
> To unsubscribe from this group, send email to

> nektra-oeapi+unsubscribegooglegroups.com or reply to this email with the
> words "REMOVE ME" as the subject.
>


Nektra OEAPI Support

unread,
Mar 25, 2010, 4:47:46 PM3/25/10
to nektra...@googlegroups.com
Hi Nekrasov,

OEAPI does not support checking if there are new messages without
starting OE.
That would require a direct connection to the mail server, and
authenticating to check if there are new messages.

Thank you for contacting Nektra's OEAPI Support.

Regards,

Federico

--
Nektra Advanced Computing
http://www.nektra.com

Nektra OEAPI Support

unread,
Mar 26, 2010, 2:32:51 PM3/26/10
to nektra...@googlegroups.com
Hi again Yuriy,

Sorry about the delay, we had a national holiday here in between.
We have tested setting the body text using the included OEAPI C++ EXE demo and it worked fine, we set the OE_MSG_SEND_WND style to display the link.
Then we send the message and we check the sent message (In 'Sent Items') and the received message ('In Inbox'), the link works correctly and is opened on IE.
There are some important details for this to work:
If you set the body text on the OEAPIObj::OnNewMsgWnd event without checking the style, the body text will be set for EVERY message window, including the Preview Pane window where the current message is displayed, and also when you open (I.E. double click) any existing message (OE_MSG_DETAIL_WND).
If you do not check for the window style, when you check the sent message, or the received message, each message window body is modified each time, and then the link does not work in this case, but this case should not be allowed to happen because you would be replacing ANY existing message body with your text/link body.
So, as I wrote before, you should check that the message window is of "OE_MSG_SEND_WND" style. But even in this case, when the user chooses to Reply or Forward a message, you would replace quoted text for your link.
So a correct way would be getting the existing HTML body first, and then adding your text/link to it.
Another alternative to add text/link in every sent message is modifying them in the OnNewMesageInOutbox event.

Thank you for contacting Nektra's OEAPI Support.

Regards,

Federico

--
Nektra Advanced Computing
http://www.nektra.com

Yuriy Pavlovsky

unread,
Mar 29, 2010, 8:53:20 AM3/29/10
to Nektra OEAPI Support, melko...@gmail.com
Hello again.

Sorry, but your answer gives nothing useful to me, because you ignored
my problems,
and told me how to resolve problems i don't have. I don't want to
create new messages,
WM will do this for me, i want to modify message during compose. I
understand that i
should get the existing HTML body first, and then add my link to it,
but this is too not a
problem for now, at this moment i want just to modify body and see the
result. And i'm
already checking for OE_MSG_SEND_WND, don't worry about this.

I'll repeat what i'm trying to do, and what goes wrong:

I have the custom button on message compose window. When i click it,
it executes this sample code:

BSTR b = SysAllocString(L"<A href=\"http://google.com\">second google</
A>");

wnd->SetBodyHTML(&b);
SysFreeString(b);

but in message itself appears only this:

<A href="">second google</A>

VB EXE demo have pretty same behavior: I create new message in WM,
open it in VB
demo, set the body with well-formed html, and receive empty src or
href attributes.

With hope for fast and useful response,

Yuriy.

On Mar 26, 9:32 pm, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:


> Hi again Yuriy,
> Sorry about the delay, we had a national holiday here in between.
> We have tested setting the body text using the included OEAPI C++ EXE demo and it worked fine, we set the OE_MSG_SEND_WND style to display the link.
> Then we send the message and we check the sent message (In 'Sent Items') and the received message ('In Inbox'), the link works correctly and is opened on IE.
> There are some important details for this to work:
> If you set the body text on the OEAPIObj::OnNewMsgWnd event without checking the style, the body text will be set for EVERY message window, including the Preview Pane window where the current message is displayed, and also when you open (I.E. double click) any existing message (OE_MSG_DETAIL_WND).
> If you do not check for the window style, when you check the sent message, or the received message, each message window body is modified each time, and then the link does not work in this case, but this case should not be allowed to happen because you would be replacing ANY existing message body with your text/link body.
> So, as I wrote before, you should check that the message window is of "OE_MSG_SEND_WND" style. But even in this case, when the user chooses to Reply or Forward a message, you would replace quoted text for your link.
> So a correct way would be getting the existing HTML body first, and then adding your text/link to it.

> Another alternative to add text/link in every sent message is modifying them in the OnNewMesageInOutbox event.Thank you for contacting Nektra's OEAPI Support. Regards, Federico -- Nektra Advanced Computinghttp://www.nektra.com
> Yuriy Pavlovsky wrote:Hi, Federico, I've done what you said, but nothing changed, href still apears empty in body. My code: BSTR b = SysAllocString(L"<A href=\"http://google.com\">second google</ A>"); Inspecting body: <A href="">second google</A> On Mar 19, 5:57 pm, Nektra OEAPI Support<oeapi-supp...@nektra.com>wrote:Hi Yuriy, Try addinghttp://to your href, like this:BSTR b = SysAllocString(L"<A href=\"http://google.com\">google</A>");A note, just in case,  if you want to set the body of the new message window only, you could make sure that thewindow styleis "OE_MSG_SEND_WND".Regards, Federico -- Nektra Advanced Computinghttp://www.nektra.com Yuriy Pavlovsky wrote:Hello. I'm developing c++ dll using OEAPI Enterprise edition v3.2.3 under Vista x86. On new message creation event, this code is executed: CComPtr<IOEMsgWnd> wnd = m_oeapi->GetMsgWnd(msgId); BSTR b = SysAllocString(L"<A href=\"google.com\">google</A>"); wnd->SetBodyHTML(&b); SysFreeString(b); But in message there is only underlined "google", without link itself. Using VB demo, ive inspected message, and found that its body contains only this : <A href="">google</A> If i add some url to href and press "Set Body", nothing changes, in fact, it is still without any url in href. Same happens when i try to add <IMG> tags - i receive empty src, no pictures displayed.

Nektra OEAPI Support

unread,
Mar 31, 2010, 4:50:19 PM3/31/10
to nektra...@googlegroups.com
Hi Yuriy,

We apologize because we assumed that you were having trouble with the window style.
We've verified the problem, it occurs in Windows Mail but not on Outlook Express.
We'll  have to analyze this issue and we'll need time to find the cause and to fix it.

Thank you for your report.
Regards,

Federico

--
Nektra Advanced Computing
http://www.nektra.com

Nektra OEAPI Support

unread,
May 14, 2010, 12:17:11 PM5/14/10
to nektra...@googlegroups.com
Hi again Yuriy,

We have been intensively analyzing the SetBodyHTML issue:
There is a problem in the way Windows Vista handles IHtmlElement::innerText, this is a Vista limitation that's impossible for us to fix.
Our procedure is correct, that's why it works on Outlook Express.

However there is another way to add a link to the message window that works on Vista.
You can get access to the IHtmlDocument2 object of the current edit window, using OEMsgWnd::GetIHTMLDocument2().
Then you could add a link (or any other html object) using IHtmlDocument2::CreateElement.

C# Example below:

    OEMsgWnd msgWnd = myOEAPI.GetMsgWnd(myOEAPI.GetActiveMsgWndID());

    IHTMLDocument2 htdoc = (IHTMLDocument2)msgWnd.GetIHTMLDocument2();

    IHTMLElement elem = htdoc.createElement("a");
    elem.innerText = "linktest";
    elem.setAttribute("href","http://www.nektra.com",0);

    IHTMLDOMNode node = (IHTMLDOMNode)elem;
    IHTMLDOMNode bodynode = (IHTMLDOMNode)htdoc.body;
    bodynode.appendChild(node);
    Marshal.ReleaseComObject(msgWnd);
    msgWnd = null;

For any further questions we remain at your service.

Best regards,


Federico
--
Nektra Advanced Computing
http://www.nektra.com



--

Yuriy Pavlovsky

unread,
May 21, 2010, 1:36:16 AM5/21/10
to Nektra OEAPI Support
Good day to you.I'm back for next round of discussion :)
Can i have an C++ example ? I've wrote one by myself, it even works,
but have some strange
and undesired behavior. Going straight to the code:

CComPtr<IOEMsgWnd> wnd = m_oeapi->GetMsgWnd(msgWndId);

/*note this block*/
BSTR b = SysAllocString(L"");
wnd->SetBodyHTML(&b);
SysFreeString(b);
/*noted block ends*/

IDispatchPtr dispatch = wnd->GetIHTMLDocument2();
CComPtr<IHTMLDocument2> htdoc;
dispatch->QueryInterface( __uuidof(IHTMLDocument2), (void **)&htdoc);
CComPtr<IHTMLElement> elem;
CComPtr<IHTMLDOMNode> domElement;
CComPtr<IHTMLDOMNode> domBody;
htdoc->createElement(L"<a>", &elem);
elem->put_innerText(L"google-link");
VARIANT var;
::VariantInit(&var);
var.vt = VT_BSTR;
V_BSTR(&var)=SysAllocString(L"http://google.com");
elem->setAttribute(L"href", var, 0);
CComPtr<IHTMLElement> body;
htdoc->get_body(&body);
body->QueryInterface(__uuidof(IHTMLDOMNode), (void **)&domBody);
elem->QueryInterface(__uuidof(IHTMLDOMNode), (void **)&domElement);
CComPtr<IHTMLDOMNode> generatedChild;
domBody->appendChild(domElement,&generatedChild);


About the noted block - without it program crashes with exception.
Dunno what it can it be, maybe something about I'm touching html body
and messages turns to html mode ?

With this block, code works, adds "google-link" to message, but again
only as text, no link at all.

With hope for some help,
Yuriy.

On May 14, 7:17 pm, Nektra OEAPI Support <oeapi-supp...@nektra.com>
wrote:

Nektra OEAPI Support

unread,
May 28, 2010, 3:51:58 PM5/28/10
to nektra...@googlegroups.com
Hi again Yuriy,

Have you tried saving/sending that email and checking the resulting email?
We have checked, and even when it first appears as regular text, the sent message contains the link.
You can switch to the "preview" mode of the message window and you will see that the link gets blue and underlined.
The link also remains blue and underlined if you switch back to the "edit" mode of the message window.
We don't know why it first appears as regular text, but that is beyond our reach.
The fact is that the resulting email contains the blue, underlined and "clickable" link.


Best regards,

Federico
--
Nektra Advanced Computing
http://www.nektra.com



Reply all
Reply to author
Forward
0 new messages