Thursday 16 November 2017

Setting up DomainKeys Identified Mail (DKIM) email authentication with .Net in 5 minutes

DomainKeys Identified Mail (DKIM) allows e-mail senders to couple their domain name with an e-mail message, thus vouching for its authenticity.

This is achieved by adding a digital signature to the e-mail message header.

Heres how you can do it in .Net.
  1. Add the DKIM.net nuget package to your solution.
     
  2. Create RSA a key pair at http://travistidwell.com/jsencrypt/demo/
     
  3. Add a TXT DNS record for your domain with
    name/host:   default._domainkey
    value:           k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBg QCHhsB36ViuKvPHAgrbVC9MPr9DuquOIseApXB4kLVy/1Hw72Moeqsmyfl M9oXL81bXVpFIU/pBc3GJUL/Fp7Pgp5VTzheelQRfqlFqKL+bt6bTXA1gz1q IAICEctjbnLxzHGbnKiotVXycfckAki01WboyZbdr5wZ 1j6Otco7x9wIDAQAB
    (without newlines copied from step 2)
     
  4. Add a TXT DNS record for your domain with
    name/host:  _domainkey
    value:         o=~;r=mail@yourdomain.com
      
  5. In code: 

   var email = new MailMessage("mail@yourdomain.com",recipient);
   email.Subject = message.Subject;

   email.Body = message.Body;

   email.IsBodyHtml = true;

   var mailClient = new SmtpClient(strSmtpServer, smtpServerPort) {

      Credentials = new NetworkCredential(strSmtpServerLogin, strSmtpServerPwd)
   };
   var privateKey = PrivateKeySigner.Create(@"-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCHhsB36ViuKvPHAgrbVC9MPr9DuquOIseApXB4kLVy/1Hw72Mo
eqsmyflM9oXL81bXVpFIU/pBc3GJUL/Fp7Pgp5VTzheelQRfqlFqKL+bt6bTXA1g
z1qIAICEctjbnLxzHGbnKiotVXycfckAki01WboyZbdr5wZ1j6Otco7x9wIDAQAB
AoGAdj6f1v+FHBDluRCTIGIHEmL8xb8sx0qY/ilaRBcd+UPC3pA+16aPhbxbA0dj
3VpmvmMNRyneAxUSTlhhubZkPacgX4h7p3B7ZOmFnzlbyENXsWcUJHGRTgt6c+0s
PRfnCr0OH0TnSWunY8pQ3AKksXdvRD1Zm3lLytN0IpH2wgECQQDiyRmEHZbbBdBJ
14YCkH2imGF/NFXazhLFBpgO0zzp3yMluQ+/cTeEZMWEFYSk1H5zwPBKkd3SD7e7
H3zXa+03AkEAmPwe4qYqahet43t7UXSBUP7zYaY4k/8y0xqnUeFKp3TOJTyowIcl
jBtDQnW5xFVPtbUVIqjx6HJqhhmuBtmBQQJABMPW7mi0v7taigKmRS2GBkGPYt3V
o/hKeqtNzJnxoLRYh7VguFQHp5d6cvEEzXXNhl8abWatM3mzEZJyzA/vdwJBAJaO
CBclUDh4dTiaHRJchacgQISpAKUlUO9QG7oI7V8/JGChAbH3ToxDiD2vfdIp4vf/
7XzeprMLZqnyO8Gh7AECQQC5U/I+yCqZtcyFTuwJYTd+dROtR7mlEZDtR+W10ZsO
luKz+8ZsoWLH4XdUWX0LRoam4dZ9PfM8uHGHBhpIY7rG
-----END RSA PRIVATE KEY-----"); //with newlines and the RSA PRIVATE KEY header/footer

   var domainKeySigner = new DomainKeySigner(privateKey, "yourdomain.com", "default",
       new string[] { "From", "To", "Subject" });
   email.DomainKeySign(domainKeySigner);

   var dkimSigner = new DkimSigner(privateKey, "yourdomain.com", "default",
         new string[] { "From", "To", "Subject" });
   email.DkimSign(dkimSigner);              

   mailClient.SendMailAsync(email);


and that is it. Now start sending your emails. If you test sending to gmail hopefully you will no longer see the red questionmark to the left of the senders address.











This DKIM solution is implemented on gooddocus.com

Monday 13 November 2017

Benefits of using Wiki's over Office documents


Many businesses around the world still use Microsoft Word, Open Office etc. to edit documents.

Employees typically have Word docs on their computer and send the latest versions on e-mail when needing to share information contained in the document.

Disadvantages of traditional Office documents

  • Cumbersome for people who have previously received documents and now need to find that document by searching their e-mail inbox, local PC file-structure or a network file-share to find the right version. Usually you'll have to search multiple locations because you don't remember where the document is. 
  • People have to make new requests for updated versions of the document.
  • The document author will have to send new versions or send it to new people who also want/should have access to the same information.
  • It is difficult to know if there is information about a topic because these documents are not searchable so you waste time figuring out if information is available somewhere. 
  • Some people will end up doing wasted work because they don't know there is relevant and valuable information available that would affect your work. 
  • Some people will make (costly) mistakes because they don't know that (critical) information is available. 

Advantages of Wiki

  • Maintain a central content repository in one place. Easy and fast access. Everyone knows where to find information.
  • There's a search feature where you can quickly find what you are looking for (no need to look through a directory structure on your own PC etc.).
  • Supports collaboration. Several people can edit the document at the same time.
  • You can add hyperlinks to other wiki pages.
  • You get version history and rollback features.
  • You can comment on someone else's wiki documents.
  • You can get alerts when important / interesting documents are updated.
  • You strengthen innovation capacity in your organization by facilitating sharing of knowledge and ideas.
  • You contribute to an openness culture, which in turn increases employee satisfaction.


When not to use a Wiki 

  • Sensitive and secret information. 
  • Documents to be printed that needs a special layout. 
  • Documents such as contracts that are not to be modified.
  • Documents to be shared with external persons.