From fce0d2fe33ed3cf59f8c8443ba180b8e102b5708 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 28 Aug 2019 19:08:57 -0400 Subject: [PATCH] Update how-send-email-nim-2019-08-28.markdown --- blog/how-send-email-nim-2019-08-28.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blog/how-send-email-nim-2019-08-28.markdown b/blog/how-send-email-nim-2019-08-28.markdown index 1d4a248..c2e397f 100644 --- a/blog/how-send-email-nim-2019-08-28.markdown +++ b/blog/how-send-email-nim-2019-08-28.markdown @@ -33,7 +33,7 @@ GMail to accept them. They are: For a more complete example, let's create a `Mailer` type and a constructor: -``` +```nim # mailer.nim import asyncdispatch, logging, smtp, strformat, strutils @@ -58,7 +58,7 @@ proc newMailer*(address, port, myAddress, myName, username, password: string): M And let's write a `mail` method to send out email: -``` +```nim proc mail(m: Mailer, to, toName, subject, body: string) {.async.} = let toList = @[fmt"{toName} <{to}>"] @@ -86,13 +86,13 @@ email provider that offers TLS/SSL-encrypted SMTP support. This also means that you need to compile this code with `--define: ssl`, so create `config.nims` and add the following: -``` +```nimscript --define: ssl ``` Here's a little wrapper using [cligen][cligen]: -``` +```nim when isMailModule: import cligen, os @@ -113,7 +113,7 @@ when isMailModule: Usage is simple: -``` +```console $ nim c -r mailer.nim --help Usage: sendAnEmail [required&optional-params]