Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: Imap.UploadMessage builds plain/text part Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
clippermadness
Newbie
Newbie


Joined: 27 October 2006
Location: United States
Online Status: Offline
Posts: 2
Posted: 27 October 2006 at 6:37pm | IP Logged Quote clippermadness

Hello,

I have a question about the .Net Imap object.
I'm building a utility to transfer messages from a web email account to an IMAP email account. When I upload a pure html message to the IMAP server using the Imap.UploadMessage function, the Imap object appears to add a plain/text part to the message. This occurs even if I've set the MailMessage.Parser.HtmlToPlainMode to HtmlToPlainAutoConvert.Never.

Any suggestions would be helpful.

Here's my code:
(the saaMsg object is the message downloaded from the webmail provider)

// Config the message to not auto-generate a plain-text MIME part
// when we set the HTML body.
msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.Never;

// Set the HTML message body.
msg.BodyHtmlText = saaMsg.MsgBody;

// Copy other data.
msg.Date = saaMsg.Date;
msg.Subject = saaMsg.Subject;
msg.From.Email = saaMsg.From.EMailAddress;
msg.From.DisplayName = saaMsg.From.Name;

foreach( SAAEmailAddress toAddr in saaMsg.To )
{
    msg.To.Add( toAddr.EMailAddress, toAddr.Name );
}

foreach( SAAEmailAddress toAddr in saaMsg.Cc )
{
    msg.Cc.Add( toAddr.EMailAddress, toAddr.Name );
}

// Upload the message to the IMAP server.
string flags = MessageFlagSet.SystemFlagsToString( SystemMessageFlags.Seen );
m_imap.UploadMessage( msg, imapFolder, flags, saaMsg.Date );
Back to Top View clippermadness's Profile Search for other posts by clippermadness
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 28 October 2006 at 7:49am | IP Logged Quote Alex

You should use:

msg.Builder.HtmlToPlainMode = HtmlToPlainAutoConvert.Never;

instead of:

msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.Never;

Builder settings affect how a message is being built from its properties.

Parser settings affect how a message is being parsed from its source into its properties.

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


Joined: 27 October 2006
Location: United States
Online Status: Offline
Posts: 2
Posted: 30 October 2006 at 3:45pm | IP Logged Quote clippermadness

Worked like a charm! Thanks for the fast and accurate response, Alex.
Back to Top View clippermadness's Profile Search for other posts by clippermadness
 

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