defmodule Mailer.Message.Id do @variant10 2 @uuid_v4 4 @doc """ Creates a uuid v4 """ def create(domain) do <> = :crypto.rand_bytes(16) (<> |> uuid_to_string) <> "@" <> domain end defp uuid_to_string(<>) do :io_lib.format("~8.16.0b-~4.16.0b-~4.16.0b-~4.16.0b-~12.16.0b", [u0, u1, u2, u3, u4]) |> to_string end end