| Author | 
         | 
         
      
        
         
         clippermadness Newbie 
          
 
  Joined: 27 October 2006 Location: United States
 Online Status: Offline Posts: 2
          | 
        
         
          
           | Posted: 27 October 2006 at 6:37pm | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Alex AfterLogic Support 
          
  
  Joined: 19 November 2003
 Online Status: Offline Posts: 2207
          | 
        
         
          
           | Posted: 28 October 2006 at 7:49am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
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 | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         clippermadness Newbie 
          
 
  Joined: 27 October 2006 Location: United States
 Online Status: Offline Posts: 2
          | 
        
         
          
           | Posted: 30 October 2006 at 3:45pm | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Worked like a charm!  Thanks for the fast and accurate response, Alex.
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |