| Author | 
         | 
         
      
        
         
         zeta Newbie 
          
  
  Joined: 02 June 2010
 Online Status: Offline Posts: 4
          | 
        
         
          
           | Posted: 02 June 2010 at 5:58pm | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Hi,
 
 I've been testing the DKIM signing 
 (DomainKeys.Sign) features and they work great 
 whenever I send(Smtp.Send) the emails. 
 
 But when it comes to using SendMailMerge 
 instead of Send, the emails that are being 
 sent are failing the DKIM test.
 
 I execute those functions in the following 
 order:
 
 smtp.Message = dk.Sign(smtp.Message, null, 
 privateKey, false, "selector");
 smtp.SendMailMerge(null, null, dt);
 
 And I believe that when SendMailMerge is 
 called, it changes the original message which 
 was signed to begin with, and turns it into an 
 unsigned one.
 
 Is there a way to use both methods 
 concurrently? Or use SendMailMerge to send 
 signed emails?
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Igor AfterLogic Support 
          
 
  Joined: 24 June 2008 Location: United States
 Online Status: Offline Posts: 6168
          | 
        
         
          
           | Posted: 03 June 2010 at 4:36am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
The important thing about using DomainKeys is 
 that you can't modify a message after signing it 
 - but that's exactly what SendMailMerge is 
 doing. So, if you'd like to use mail merge for 
 messages signed with DomainKeys, then you need 
 to run mail merge first, then sign messages and 
 send them out. Using msg.Merge.MergedMessage for 
 that looks like a perfect approach for this.
 
 --
 Regards,
 Igor, AfterLogic Support
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         zeta Newbie 
          
  
  Joined: 02 June 2010
 Online Status: Offline Posts: 4
          | 
        
         
          
           | Posted: 03 June 2010 at 10:35am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
When you mention "run mail merge first", are you   
 referring to smtp.SendMailMerge or 
 msg.Merge.MergedMessage?
 
 As far as I see it, using smtp.SendMailMerge 
 would send an email with a wrong signature. And 
 using msg.Merge.MergedMessage would not be able 
 to use the DataTable. Is there something I'm 
 missing here?
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Igor AfterLogic Support 
          
 
  Joined: 24 June 2008 Location: United States
 Online Status: Offline Posts: 6168
          | 
        
         
          
           | Posted: 04 June 2010 at 6:44am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Both methods can use any data sources 
 including database of course, but with 
 SendMailMerge that works in a simpler way we 
 must admit.
 
 The approach we'd suggest is: do not sign 
 messages before SendMailMerge, instead use 
 Smtp.SendingMessage event, the message will be 
 fully composed at the moment, so there 
 shouldn't be any problems with wrong 
 signatures.
 
 --
 Regards,
 Igor, AfterLogic Support
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         zeta Newbie 
          
  
  Joined: 02 June 2010
 Online Status: Offline Posts: 4
          | 
        
         
          
           | Posted: 04 June 2010 at 11:01am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I'm having problems signing the message at the 
 event. 
 
 
Code: 
   
    
    
      
       
 private void smtp_SendingMessage(object 
 sender, SmtpSendingMessageEventArgs e)
 {
       var dk = new DomainKeys(true);
       e.MailMessage = dk.Sign(e.MailMessage, 
 null, privateKey, false, "selector", 
 DomainKeysTypes.DKIM);
 }
  | 
       
       | 
    
    | 
 
 
 
 It seems that e.MailMessage is read-only.
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Igor AfterLogic Support 
          
 
  Joined: 24 June 2008 Location: United States
 Online Status: Offline Posts: 6168
          | 
        
         
          
           | Posted: 07 June 2010 at 8:16am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
It is read-only indeed, but you shouldn't have 
 problems assigning signed message using 
 LoadMessage method.
 
 Please let us know if this helps you. Thanks!
 
 --
 Regards,
 Igor, AfterLogic Support
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         zeta Newbie 
          
  
  Joined: 02 June 2010
 Online Status: Offline Posts: 4
          | 
        
         
          
           | Posted: 07 June 2010 at 10:58am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
OK, now everything works. (use the 
 GetMessageRawData() after signing, people).
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Alex AfterLogic Support 
          
  
  Joined: 19 November 2003
 Online Status: Offline Posts: 2207
          | 
        
         
          
           | Posted: 07 June 2010 at 11:12am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Good to hear. Anyway, we'll think about how to make DK/DKIM signing more straight-forward during bulk mail operations.
 
 Regards,
 Alex
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |