Author |
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 07 November 2007 at 12:27pm | IP Logged
|
|
|
Hello,
I've received a spam message. It is correctly displayed in most mailers and not correctly using the Message object. It's a bit tricky encoded but you should handle this easily.
Here is the EML file:
http://www.pixexpose.com/mailmsg.zip
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 07 November 2007 at 1:12pm | IP Logged
|
|
|
Message object itself does not render anything. I just tested the message you provided and found that MailBee.Message correctly returns its content. Its content is HTML so you should display it in HTML container (like most mail clients do).
The bug in this message is that it contains HTML in plain-text part, not only in HTML part. But if the message has both plain-text and HTML parts, mail clients show HTML part. And this part is OK, so the problem with plain-text part does not arise (mail clients simply do not use it because HTML part is available).
Regards,
Alex
|
Back to Top |
|
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 13 February 2008 at 4:44am | IP Logged
|
|
|
Hello,
I've got a small problem, I think. It even might be not a problem, just my misunderstanding.
My software allows to browse EML files. Now I have an EML file encoded using the koi8-r encoding. It has both HTML and Plain text parts. It doesn't matter if I try to display the plain text part in a control (e.g. a memo, text got as BodyText) or the HTML part in MS Internet Explorer (get as AltBodyText or BodyText), I always see ???? characters. The same in the Mozilla Firefox used as embedded control. It's interesting because the same EML file displayed in the Mozilla Thunderbird shows russian characters with no problems.
I've tried to experiment with the CodePageMode property that I set before the message object ImportFromFile method, but this cause nothing. I always see ???? characters even in the MS Internet Explorer source preview (Firefox the same).
Isn't really possible to have the koi8-r characters readable, at least in a HTML browser ? My OS seems to be able to do this because Thunderbird displays the same EML file with readable text (Russian). It's Vista.
By the way, another problem. I've seen an example of displaying a message in your docs online. Here it is:
http://www.afterlogic.com/mailbee/docs/index.htm
There's a part:
Code:
' HTML message?
If objMsg.BodyFormat = 1 Then
' The message is HTML, so display
' plain version of HTML message body
MsgBox objMsg.AltBodyText
Else
' No, the message is not HTML,
' so display message body
MsgBox objMsg.BodyText
End If
|
|
|
So, if the BodyFormat is 1 then we have HTML message and should get the HTML text to display in a HTML embedded browser using the AltBodyText. Unfortunately each HTML message (with Bodyformat == 1) that I tested returns no HTML code from the AltBodyText method. However the BodyText method contains HTML code. I'm a bit confused now ... It's all for EML file imported to the Message object.
Regards,
Rafal Platek
|
Back to Top |
|
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 13 February 2008 at 4:57am | IP Logged
|
|
|
By the way, setting the CodePage and CodePageMode properties has no effect. Example:
Code:
FMessageTesdter2.CodePageMode := 2;
FMessageTesdter2.ImportFromFile(anEMLfilepath);
ShowMessage(IntToStr(FMessageTesdter2.CodePageMode));
|
|
|
The ShowMessage() dialog box always shows the '0' value... The same for CodePage property. And the Charset property is always '' (empty).
Is this supposed ?
OS: Delphi, TLB imported and Vista OS.
Cheers,
Rafal
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 13 February 2008 at 5:38am | IP Logged
|
|
|
We've just implemented the following sample:
Code:
Set objMsg = CreateObject("MailBee.Message")
MsgBox objMsg.CodePageMode
objMsg.CodePageMode = 2
MsgBox objMsg.CodePageMode
objMsg.ImportFromFile "D:\test\msg1.eml"
MsgBox objMsg.CodePageMode |
|
|
And got the following result:
0
2
2
In your case, the issue may be caused by incorrect TLB import. As we mentioned earlier, we experienced a lot of problems with various versions of Delphi in the past. For instance, this property may be imported as an empty method (we experienced this many times).
Try to analyze the tlb files, locate the CodePageMode wrapper and compare with other properties' wrappers. Most probably, you'll see the difference.
Also, take a look at AltBodyText and BodyText properties and make sure they're imported correctly.
Using version of Delphi which is liable to such issue, one has to re-check each thing twice because cannot trust the IDE/programming language.
Best regards,
Andrew
|
Back to Top |
|
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 13 February 2008 at 6:58am | IP Logged
|
|
|
I've looked into the TLB file and the CodePageMode (and others) had just simple "exit" command instead of assignment. I've corrected this and I can assign codepagemode correctly. Thanks. Now I can see national characters instead of the "???".
However the AltBodyText method seems to be correctly imported to the TLB. It's just a OLE property reading. Nothing special there.
Code:
function TMessage.Get_BodyText: WideString;
begin
Result := DefaultInterface.BodyText;
end;
function TMessage.Get_AltBodyText: WideString;
begin
Result := DefaultInterface.AltBodyText;
end;
|
|
|
The DefaultInterface is IMessage and these two functions are imported as:
Code:
IMessage = interface(IDispatch) ['{61126A05-0644-4C9F-94B4-60497F5C95A7}']
function Get_BodyText: WideString; safecall;
function Get_AltBodyText: WideString; safecall;
|
|
|
Everything seems to be ok and works otherway :-( However the GetBodyWithEmbeddedObjects() method returns correct HTML code for HTML message. Are you sure that there is everything ok with the AltBodyText property and the sample code from your documentation works properly? Even if I have aMsg.BodyFormat == 1, the AltBodyText contains plain text and the BodyText contains HTML code. The TLB imports seems ok and the interface calls are directed to the proper methods in the IMessage object, I think...
Cheers,
Rafal
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 February 2008 at 7:45am | IP Logged
|
|
|
Are you sure your HTML emails do not contain plain-text version? To check this, open .EML file in Notepad and check whether the message contains text/plain version. It it does, MailBee will use this section for AltBodyText if the message also has text/html part.
And, if the message does contain text/plain part but that part is empty, this means the composer of the message decided to keep plain-text version empty. That's why you you might be getting empty plain-text part. Example follows:
Code:
This is a multi-part message in MIME format.
------=_NextPart_000_0048_01C86E1B.1A951790
Content-Type: text/plain;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable
------=_NextPart_000_0048_01C86E1B.1A951790
Content-Type: text/html;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-7">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>test</FONT></DIV><BR>
</BODY></HTML>
------=_NextPart_000_0048_01C86E1B.1A951790-- |
|
|
Quote:
Even if I have aMsg.BodyFormat == 1, the AltBodyText contains plain text and the BodyText contains HTML code. |
|
|
Yes, and what's wrong with this behaviour?
Regards,
Alex
|
Back to Top |
|
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 13 February 2008 at 11:09am | IP Logged
|
|
|
Here is an example message source:
Code:
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01C86DD3.04168D77
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Always wished to bang more chicks? With this you will be able to!
Go to url
------=_NextPart_000_0006_01C86DD3.04168D77
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3199" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
Always wished to bang more chicks? With this you will be able to!<br>
<A href=3D"http://www.Likesommins.com/">Go to url</A></BODY></HTML>
------=_NextPart_000_0006_01C86DD3.04168D77--
|
|
|
In this case the AltBodyText contains plain text, not HTML. I've expected HTML here because I've seen an example in your documentation that I'll quote again:
Code:
' HTML message?
If objMsg.BodyFormat = 1 Then
' The message is HTML, so display
' plain version of HTML message body
MsgBox objMsg.AltBodyText
Else
' No, the message is not HTML,
' so display message body
MsgBox objMsg.BodyText
End If
|
|
|
If I good understand the example the BodyFormat == 1 means that the message is in HTML and to get the HTML source I should use the AltBodyText. I'm trying this and get plain text and the BodyText contains HTML text. Perhaps I misunderstood the example...?
Cheers,
Rafal
|
Back to Top |
|
|
rafaellop Newbie
Joined: 13 September 2007
Online Status: Offline Posts: 26
|
Posted: 13 February 2008 at 1:57pm | IP Logged
|
|
|
Ok, I've read the AltBodyText and BodyText manuals once again and I got the difference. Thanks for your patience ... :)
Cheers,
Rafal
|
Back to Top |
|
|