Skip to content

Commit

Permalink
Merge pull request #57 from mabiede/bug/mutated-vowel
Browse files Browse the repository at this point in the history
Bug/mutated vowel
  • Loading branch information
aronerben authored Feb 29, 2024
2 parents ab46920 + 3338629 commit c38446b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM hadolint/hadolint:latest-alpine AS hadolint
FROM ocaml/opam:debian-11-ocaml-4.12
FROM ocaml/opam:debian-ocaml-4.14

USER root

Expand Down
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"ocaml.sandbox": {
"kind": "global"
}
}
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"DavidAnson.vscode-markdownlint",
"donjayamanne.githistory",
"eamodio.gitlens",
"exiasr.hadolint",
"irongeek.vscode-env",
"ms-vscode.makefile-tools",
"ocamllabs.ocaml-platform"
]
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"donjayamanne.githistory",
"eamodio.gitlens",
"exiasr.hadolint",
"irongeek.vscode-env",
"ocamllabs.ocaml-platform",
"DavidAnson.vscode-markdownlint",
"ms-vscode.makefile-tools"
]
}
}
}
2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
(>= 0.2.1))
(colombe
(>= 0.7.0))
(containers
(>= 3.13.1))
(fmt
(>= 0.8.8))
(fpath
Expand Down
1 change: 1 addition & 0 deletions letters.opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ depends: [
"dune" {>= "2.7"}
"ca-certs" {>= "0.2.1"}
"colombe" {>= "0.7.0"}
"containers" {>= "3.13.1"}
"fmt" {>= "0.8.8"}
"fpath" {>= "0.7.0"}
"lwt" {>= "5.2.0"}
Expand Down
58 changes: 18 additions & 40 deletions letters.opam.locked
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "0.3.2"
version: "0.3.3"
synopsis: "Client library for sending emails over SMTP"
description: "Simple to use SMTP client implementation for OCaml"
maintainer: ["Miko Nieminen <[email protected]>"]
Expand All @@ -9,13 +9,9 @@ homepage: "https://github.com/oxidizing/letters/"
doc: "https://oxidizing.github.io/letters/"
bug-reports: "https://github.com/oxidizing/letters/issues"
depends: [
"alcotest" {= "1.7.0" & with-test}
"alcotest-lwt" {= "1.7.0" & with-test}
"angstrom" {= "0.15.0"}
"angstrom" {= "0.16.0"}
"asn1-combinators" {= "0.2.6"}
"astring" {= "0.8.5"}
"base" {= "v0.15.1" & dev}
"base-bigarray" {= "base"}
"base-bytes" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
Expand All @@ -24,79 +20,61 @@ depends: [
"bigstringaf" {= "0.9.1"}
"bos" {= "0.2.1"}
"ca-certs" {= "0.2.3"}
"camlp-streams" {= "5.0.1" & dev}
"cmdliner" {= "1.2.0"}
"coin" {= "0.1.4"}
"colombe" {= "0.8.0"}
"conf-gmp" {= "4"}
"conf-gmp-powm-sec" {= "3"}
"conf-pkg-config" {= "3"}
"containers" {= "3.13.1"}
"cppo" {= "1.6.9"}
"csexp" {= "1.5.2"}
"cstruct" {= "6.2.0"}
"domain-name" {= "0.4.0"}
"dune" {= "3.9.1"}
"dune-build-info" {= "3.9.1" & dev}
"dune-configurator" {= "3.9.1"}
"dune" {= "3.14.0"}
"dune-configurator" {= "3.14.0"}
"duration" {= "0.2.1"}
"either" {= "1.0.0" & dev}
"either" {= "1.0.0"}
"emile" {= "1.1"}
"eqaf" {= "0.9"}
"fix" {= "20230505" & dev}
"fmt" {= "0.9.0"}
"fpath" {= "0.7.3"}
"gmap" {= "0.3.0"}
"hkdf" {= "1.0.4"}
"ipaddr" {= "5.5.0"}
"ke" {= "0.6"}
"logs" {= "0.7.0"}
"lwt" {= "5.6.1"}
"lwt" {= "5.7.0"}
"macaddr" {= "5.5.0"}
"menhir" {= "20230608" & dev}
"menhirLib" {= "20230608" & dev}
"menhirSdk" {= "20230608" & dev}
"mirage-crypto" {= "0.11.1"}
"mirage-crypto-ec" {= "0.11.1"}
"mirage-crypto-pk" {= "0.11.1"}
"mirage-crypto-rng" {= "0.11.1"}
"mirage-crypto-rng-lwt" {= "0.11.1"}
"mirage-crypto" {= "0.11.3"}
"mirage-crypto-ec" {= "0.11.3"}
"mirage-crypto-pk" {= "0.11.3"}
"mirage-crypto-rng" {= "0.11.3"}
"mirage-crypto-rng-lwt" {= "0.11.3"}
"mrmime" {= "0.6.0"}
"mtime" {= "2.0.0"}
"ocaml" {= "4.13.1"}
"ocaml-base-compiler" {= "4.13.1"}
"ocaml-config" {= "2"}
"ocaml-options-vanilla" {= "1"}
"ocaml" {= "4.14.1"}
"ocaml-syntax-shims" {= "1.0.0"}
"ocaml-version" {= "3.6.1" & dev}
"ocamlbuild" {= "0.14.2"}
"ocamlbuild" {= "0.14.3"}
"ocamlfind" {= "1.9.6"}
"ocamlformat" {= "0.26.0" & dev}
"ocamlformat-lib" {= "0.26.0" & dev}
"ocp-indent" {= "1.8.1" & dev}
"ocplib-endian" {= "1.2"}
"pbkdf" {= "1.2.0"}
"pecu" {= "0.6"}
"prettym" {= "0.0.3"}
"ptime" {= "1.1.0"}
"re" {= "1.10.4"}
"result" {= "1.5"}
"re" {= "1.11.0"}
"rosetta" {= "0.3.0"}
"rresult" {= "0.7.0"}
"sendmail" {= "0.8.0"}
"seq" {= "base"}
"sexplib0" {= "v0.15.1"}
"stdio" {= "v0.15.0" & dev}
"stdlib-shims" {= "0.3.0" & with-test}
"tls" {= "0.17.1"}
"tls-lwt" {= "0.17.1"}
"sexplib0" {= "v0.16.0"}
"tls" {= "0.17.3"}
"tls-lwt" {= "0.17.3"}
"topkg" {= "1.0.7"}
"unstrctrd" {= "0.3"}
"uucp" {= "15.0.0" & dev}
"uuseg" {= "15.0.0" & dev}
"uutf" {= "1.0.3"}
"uuuu" {= "0.3.0"}
"x509" {= "0.16.5"}
"yojson" {= "2.1.0" & with-test}
"yuscii" {= "0.3.0"}
"zarith" {= "1.13"}
]
Expand Down
1 change: 1 addition & 0 deletions lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ca-certs
colombe
colombe.emile
containers
domain-name
emile
fmt
Expand Down
19 changes: 11 additions & 8 deletions lib/letters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let domain_of_reverse_path = function
;;

let to_recipient_to_address : recipient -> Mrmime.Address.t option =
fun recipient ->
fun recipient ->
match recipient with
| To address ->
(match Mrmime.Mailbox.of_string address with
Expand All @@ -93,7 +93,7 @@ let to_recipient_to_address : recipient -> Mrmime.Address.t option =
;;

let cc_recipient_to_address : recipient -> Mrmime.Address.t option =
fun recipient ->
fun recipient ->
match recipient with
| To _ -> None
| Cc address ->
Expand All @@ -113,7 +113,11 @@ let create_email ?reply_to ~from ~recipients ~subject ~body () =
| Ok v -> v
| Error _ -> raise (Invalid_email_address from)
in
let subject = Unstructured.Craft.v subject in
let subject : Unstructured.t =
CCUtf8_string.(of_string subject |> CCOption.map to_list)
|> CCOption.map (CCList.map (fun m -> `Uchar m))
|> CCOption.get_or ~default:(Unstructured.Craft.v subject)
in
let date = Date.of_ptime ~zone:Date.Zone.GMT (Ptime_clock.now ()) in
let from_addr = from |> to_mailbox in
let to_addresses = List.filter_map to_recipient_to_address recipients in
Expand All @@ -126,11 +130,10 @@ let create_email ?reply_to ~from ~recipients ~subject ~body () =
; Field.(Field (Field_name.cc, Addresses, cc_addresses))
]
@ (reply_to
|> Option.map (fun a ->
Field.(
Field
(Field_name.reply_to, Addresses, [ a |> to_mailbox |> Address.mailbox ])))
|> Option.to_list)
|> Option.map (fun a ->
Field.(
Field (Field_name.reply_to, Addresses, [ a |> to_mailbox |> Address.mailbox ])))
|> Option.to_list)
in
let plain_text_headers =
let content1 =
Expand Down

0 comments on commit c38446b

Please sign in to comment.