Search The ForumSearch   RegisterRegister  LoginLogin

MailBee SMTP

 AfterLogic Forum : MailBee SMTP
Subject Topic: Sending HTML mail with No AltBody Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Luca
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 29 June 2005 at 10:14am | IP Logged Quote Luca

Should I create an HTML message with empty AltBodyText, when sending it AltBodyText is generated by MailBee using GetPlainFromHtml method (as it is stated in docs).

Is there a way to avoid this, in case I just want to send an HTML message with no plain text at all?
Back to Top View Luca's Profile Search for other posts by Luca
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 29 June 2005 at 11:09am | IP Logged Quote Alex

MailBee automatically generates plain-text version only when receiving mail. When composing mail, it's REQUIRED to call Message.MakeAltBody in order to create plain-text version.

So, you need to do nothing in order to create HTML-only messages.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Luca
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 29 June 2005 at 11:45am | IP Logged Quote Luca

Sorry it was my mistake: this behaviour only happens when importing an .eml file. My app sends a message, then saves it and finally reloads it. In this case (after reloading) AltBodyText is automatically generated:


Dim oMailer As New MailBee.SMTP
    
oMailer.Message.BodyFormat = 1
oMailer.Message.BodyText = "<p>test</p>"
MsgBox oMailer.Message.AltBodyText
    
oMailer.Message.SaveMessage "C:\test.eml"
oMailer.Message.ImportFromFile "C:\test.eml"
MsgBox oMailer.Message.AltBodyText


The problem is fixed using ".AltBodyOptions" property (from yor previous message):


Dim oMailer As New MailBee.SMTP
    
oMailer.Message.BodyFormat = 1
oMailer.Message.BodyText = "<p>test</p>"
MsgBox oMailer.Message.AltBodyText
    
oMailer.Message.SaveMessage "C:\test.eml"


oMailer.Message.AltBodyOptions = 0

oMailer.Message.ImportFromFile "C:\test.eml"
MsgBox oMailer.Message.AltBodyText
Back to Top View Luca's Profile Search for other posts by Luca
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 29 June 2005 at 12:17pm | IP Logged Quote Alex

BTW, if you need to just resend messages preserving original message body (i.e. everything you want is to add/modify some headers and resend the message) you can use undocumented MinimalRebuild property and AddHeader/RemoveHeader methods:

Code:

oMailer.Message.MinimalRebuild = True
oMailer.Message.ImportFromFile "C:\test.eml"
oMailer.Message.AddHeader "To", "someone@domain.com"
MsgBox oMailer.Message.AltBodyText
oMailer.Send


Note that AddHeader will overwrite existing header if it already exists.

In minimal rebuild mode, MailBee does not touch message body itself, and headers manipulation is limited to AddHeader/RemoveHeader methods. Setting and calling other message manipulation methods and properties does not have any effect. MailBee will not add its own headers, etc. For example, "Received:" timestamp headers will be preserved if you didn't delete them with RemoveHeader method.

Thus, minimal rebuild mode allows you to keep original encodings, MIME boundaries, headers formatting, etc.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Luca
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 29 June 2005 at 12:35pm | IP Logged Quote Luca

Thanks, that was very useful (and very fast support too: I'm very glad I made the right choice buying your components some days ago).

Will undocumented properties (or methods) be preserved in future releases?

Back to Top View Luca's Profile Search for other posts by Luca
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 29 June 2005 at 1:04pm | IP Logged Quote Alex

Yes, all undocumented properties and methods will be preserved.

Also, some of these properties/methods will be officially released/documented in future versions.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide