Coder Social home page Coder Social logo

mailman-elixir / mailman Goto Github PK

View Code? Open in Web Editor NEW
202.0 202.0 73.0 302 KB

Mailman provides a clean way of defining mailers in your Elixir applications

Home Page: https://github.com/mailman-elixir/mailman

License: Other

Elixir 99.87% HTML 0.13%
elixir email sending

mailman's People

Contributors

arunvelsriram avatar barry-w-hill avatar danmcclain avatar dejanstrbac avatar gshaw avatar hamann avatar houshuang avatar jonlunsford avatar kamilc avatar kdawgwilk avatar keichan34 avatar kianmeng avatar leaexplores avatar lowks avatar martinmaillard avatar martinos avatar maxbeizer avatar maxneuvians avatar mmartinson avatar mremond avatar skosch avatar swerter avatar trinode avatar ugisozols avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mailman's Issues

Change ex_doc dependency to be only for dev environment

I'd like to keep the ex_doc dependency of my project only the development environment so it isn't brought into production. I'm pretty sure the same could be said for mailman.

The fix is to add an only clause to the dependency.

{ :ex_doc, ">= 0.6.0", only: :dev },

Delivering emails from an external service always gets a time out?

I'm trying to use your library to send emails from either Gmail or Amazon SES and I think I have everything correctly configured like you have on the README and also from this blog post (my code is pretty much the same):

http://reganmian.net/blog/2015/09/03/sending-and-receiving-email-with-elixir/

Everything seems to work when I use Local SMTP but if I try with an external server it always gets a timeout? Has the documentation changed somehow?

** (FunctionClauseError) no function clause matching in Mailman.Render.normalize_addresses/1

hey mailman is crashing
** (FunctionClauseError) no function clause matching in Mailman.Render.normalize_addresses/1
(mailman 0.4.2) lib/mailman/render.ex:151: Mailman.Render.normalize_addresses("[email protected]")
(mailman 0.4.2) lib/mailman/render.ex:131: Mailman.Render.headers_for/1
(mailman 0.4.2) lib/mailman/render.ex:18: Mailman.Render.nest_parts/3
(mailman 0.4.2) lib/mailman/render.ex:8: Mailman.Render.render/3
(mailman 0.4.2) lib/mailman.ex:43: Mailman.deliver/3

Update iconv dependency

Currently mailman depends on a specific eiconv fork that is not on hex.pm. It seems this module is deprecated and https://hex.pm/packages/iconv is the module to use. Since this module is even in hex.pm already, it would be much better to depend to this one.

Does Mailman need help or a new home?

@kamilc I'm using a fork of mailman at the moment to get it working, but I'm not sure that's sustainable. Do you need help maintaining the package? I'd be happy to pitch in here an triage PRs.

module EEx is not available

Hi

I'm using mailman on Mac OS X Yosemite (10.10.2).
I followed the tutorial as specified but ran into the following error when sending an email.

My configuration:

def config do
    %Mailman.Context{
      config:   %Mailman.SmtpConfig{ relay: "mailserver.xxxx.co.za", port: 25 },
      composer: %Mailman.EexComposeConfig{}
    }
  end
** (UndefinedFunctionError) undefined function: EEx.eval_string/2 (module EEx is not available)
    EEx.eval_string("", [name: "Yo"])
    lib/mailman/render.ex:127: Mailman.Render.compile_parts/2
    lib/mailman/render.ex:6: Mailman.Render.render/2
    lib/mailman.ex:15: Mailman.deliver/2
    (elixir) lib/kernel/cli.ex:70: anonymous fn/3 in Kernel.CLI.exec_fun/2

Am I missing something obvious?
Please let me know if I can assist or provide more information....

Always returns :ok?

This is a great library, and I'm using it to send hundreds of personalized emails per day through Amazon SES. However, it seems that it always returns :ok, no matter if it was successful or not - even on completely made up domains (I'm using the external_smtp module).

This becomes especially important because Amazon has some rate limiting, and I should be able to retry if a mail fails, etc.

(Actually do you know of any library for sending large amounts of emails which handle throttling, retrying, etc? Would be incredibly useful - but knowing if a delivery succeeded or not is the first step).

thanks!

From "name" possible instead of from email?

Is it possible to send the email such that the receiver see's the from name instead of the from email address?

Something like this:

"John Smith <[email protected]>"
This format is resulting in mailman completely dropping the email delivery.

I'll try taking a look if I can get a pointer (if it is possible)

Attachment encoding options

Attachments are by default, Base64 encoded. It'd be nice to have that be optional, either in a global Mailman config setting, or maybe per attachment by passing a tuple with the path and options to the inline function.

Mix test - 2 tests fail

Good

Thanks again for your effort here.
In trying to resolve my prior logged issue, I pulled the latest repo and had 2 unit tests fail.

  1) test sending testing emails works (MailmanTest)
     test/mailman_test.exs:66
     ** (UndefinedFunctionError) undefined function: :eiconv.open/2 (module :eiconv is not available)
     stacktrace:
       (eiconv) :eiconv.open("utf-8//IGNORE", "utf-8")
       (gen_smtp) src/mimemail.erl:477: :mimemail.decode_body/4
       (gen_smtp) src/mimemail.erl:268: :mimemail.decode_component/4
       (gen_smtp) src/mimemail.erl:386: :mimemail."-split_body_by_boundary/4-lc$^1/1-0-"/3
       (gen_smtp) src/mimemail.erl:259: :mimemail.decode_component/4
       (mailman) lib/mailman/parsing.ex:5: Mailman.Parsing.parse/1
       test/mailman_test.exs:68



  2) test encodes attachements properly (MailmanTest)
     test/mailman_test.exs:75
     ** (UndefinedFunctionError) undefined function: :eiconv.open/2 (module :eiconv is not available)
     stacktrace:
       (eiconv) :eiconv.open("utf-8//IGNORE", "us-ascii")
       (gen_smtp) src/mimemail.erl:477: :mimemail.decode_body/4
       (gen_smtp) src/mimemail.erl:268: :mimemail.decode_component/4
       (gen_smtp) src/mimemail.erl:386: :mimemail."-split_body_by_boundary/4-lc$^1/1-0-"/3
       (gen_smtp) src/mimemail.erl:259: :mimemail.decode_component/4
       (mailman) lib/mailman/parsing.ex:5: Mailman.Parsing.parse/1
       (mailman) lib/mailman/parsing.ex:26: Mailman.Parsing.parse!/1
       test/mailman_test.exs:77

Is this me or legitimate issues?

Thanks
Dane

%Mailman.deliver/2 eats my attachments

I want forward emails by simply changing the :to address.

The way it goes:

  1. Get email by gen_smtp.
  2. Parse email with Mailman.Email.parse!/1 into %Mailman.Email{}
  3. Change the :to address email = %Mailman.Email{}; email = Map.put(email, :to, ["[email protected]"])
  4. Send email by {:ok, sent_email} = Mailman.deliver(email, config())

After step 3 the email looks like this:

%Mailman.Email{
  attachments: [
    %Mailman.Attachment{
      data: <<0, 0, 0, 0, 0, 171, 205, 239, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 9,
        0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
        2, 0, ...>>,
      disposition: "",
      file_name: "users.dets",
      mime_sub_type: "octet-stream",
      mime_type: "application"
    }
  ],
  bcc: [],
  cc: [],
  data: %{},
  delivery: "Wed, 28 Apr 2021 06:45:38 +0200",
  from: "[email protected]",
  html: "<!DOCTYPE html><html><head><title></title><style type=\"text/css\">p.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Hallo Welt,<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">ich bin eine HTML Mail. <br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Foo<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Bar<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Baz<br></div></body></html>",
  reply_to: "",
  subject: "Testmail mit Umlauten Ä Ö Ü",
  text: "Hallo Welt,\r\n\r\nich bin eine HTML Mail. \r\n\r\nFoo\r\nBar\r\nBaz",
  to: ["[email protected]"]
}

When I parse sent_email after step 4 it looks like this:

%Mailman.Email{
  attachments: [],
  bcc: [],
  cc: [],
  data: %{},
  delivery: "Wed, 28 Apr 2021 06:46:34 +0200",
  from: "[email protected]",
  html: "<!DOCTYPE html><html><head><title></title><style type=\"text/css\">p.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}\r\np.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Hallo Welt,<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">ich bin eine HTML Mail. <br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\"><br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Foo<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Bar<br></div><div style=\"font-family:menlo, consolas, monospace;color:rgb(0, 0, 128);\">Baz<br></div></body></html>",
  reply_to: "",
  subject: "Testmail mit Umlauten Ä Ö Ü",
  text: "Hallo Welt,\r\n\r\nich bin eine HTML Mail. \r\n\r\nFoo\r\nBar\r\nBaz",
  to: ["[email protected]"]
}

While sending, the attachments disapear and they do not arrive at the destination mailbox. Please can you show me, what is my mistake here? Do I have to set any special config parameters?

Attachments with extension not in @mime_types fail

Attaching a .docx, for instance, generates the following:

** (ArgumentError) argument error
        (stdlib) binary.erl:244: :binary.split/3
                 lib/mailman/attachment.ex:698: Mailman.Attachment.mime_type_for_path/1
                 lib/mailman/attachment.ex:668: Mailman.Attachment.inline/1
                 lib/mailman/attachment.ex:679: Mailman.Attachment.inline!/1
    (mothership) lib/mothership.ex:52: Mothership.attach_files/1
    (mothership) lib/mothership.ex:43: Mothership.generate_email/1
        (elixir) lib/enum.ex:1047: anonymous fn/3 in Enum.map/2
        (elixir) lib/enum.ex:1401: anonymous fn/3 in Enum.reduce/3

HTML Templates not working on send

Hello ;)

I realise there is a PR for this, but I don't want others who may be considering mailman to spend time configuring and implementing a solution only to realise the problem.

I make reference to:
#10

Thanks and look forward to the fix!
Dane

How can I change the return path before deliver the mail?

I would like to change the return path of the email. But no matter what I try:

def deliver(return_path, from, to, email) do
   email = email
     |> Map.put(:to, [to])
     |> Map.put(:from, from)
     |> Map.put(:reply_to, from)
     |> Map.put(:return_path, return_path)

  {:ok, send_mail} = Mailman.deliver(email, config())
end

or

def deliver(return_path, from, to, email) do
   email = email
     |> Map.put(:to, [to])
     |> Map.put(:from, from)
     |> Map.put(:reply_to, from)
     |> Map.put_new(:return_path, return_path)

  {:ok, send_mail} = Mailman.deliver(email, config())
end

... the return path of the outgoing email is set to the same value as the from: value.

Is there a way to change the value of the return-path?

The readme claims wrong version is installable through hex

In the readme it says we need to specify the deps as follows:

{:mailman, "~> 0.4.0"},
{:eiconv, github: "zotonic/eiconv"}

This does not work since No matching version for mailman ~> 0.4.0 (from: mix.exs) in registry which is correct according to https://hex.pm/packages/mailman

What is the currently recommended approach to use this library? Stay with the 0.3.0 release or install 0.4.0 from Github?

CI testing seems to be broken?

When I open a new PR, CircleCI says

We couldn't detect the settings for your project! Please make sure you have a configuration file in place, and check our doc about manual build setup in CircleCI 2.0 or CircleCI 1.0.

I'm not sure how to set this up, but it'd be nice to have (especially since we have some pretty good tests now, for a start at least).

Compatibility error with Elixir 1.7 when sending mail

Hi,

I've just passed my projects to Elixir 1.7.1, with docker image. I use mailman to send confirmation mail when creating an account on my app, but I saw when I tested it after update that gen_smtp throw me an error for a missing case in a pattern matching. Here is the stack :

`[error] Task #PID<0.489.0> started from #PID<0.486.0> terminating

container | ** (MatchError) no match of right hand side value: 'C3'

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:898: :mimemail.encode_quoted_printable/3

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:845: :mimemail.encode_quoted_printable/1

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:812: :mimemail.encode_component_part/1

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:786: anonymous fn/2 in :mimemail.encode_component/5

container | (stdlib) lists.erl:1250: :lists.flatmap/2

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:783: :mimemail.encode_component/5

container | (gen_smtp) /app/deps/gen_smtp/src/mimemail.erl:119: :mimemail.encode/2

container | (mailman) lib/mailman.ex:43: Mailman.deliver/3

container | (agilitic_auth) web/services/register_service.ex:336: Project.Web.RegisterService.send_confirmation_email/2

container | (elixir) lib/task/supervised.ex:89: Task.Supervised.do_apply/2

container | (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

container | Function: #Function<0.31475494/0 in Project.Web.RegisterService.create_account/3>

container | Args: []`

With Elixir 1.6 image, it works fine.

Email adapter have different blocking behavior

Hi,

I noticed that the TestAdapter will do a non-blocking cast for delivering emails, but other adapters will do a blocking call. This causes different handling of the deliver result depending whether I am running my tests or being in dev or production mode. They all should be either blocking or non-blocking.

Attachment without MIME type in file path

Hi

If the attachment does not contain any MIME type information in the path, function mime_full_for_path(path) will return nil, which then brakes mime_type_for_path(path) on line 698 in file lib/mailman/attachment.ex

Would be great if you could have a look. Thanks.

Inline images

(Mostly FYI @kamilc and @Ch4s3)

I need to send emails with inline images, so I just created a new branch called inline-images. From what I can tell, the missing pieces are Content-Disposition: inline and Content-ID: ..., and for now I'd be happy to let users add those in manually. However I now see that gen_smtp won't take extra parameters, so I'll be opening an issue there too.

I'm also going to use that branch to do some light cleanup so the warnings go away, and then later look at some of the open issues when I have time. Feel free to share your thoughts and/or ideas on the inline images thing though.

Add CONTRIBUTING.md

Hi. Having a contributing guide will be really helpful for people who are interested in fixing bugs and adding features.

Let's make mailman more attractive

Since we have friendly competition now, I think this project would benefit from a more welcoming appearance in general.

  • a pleasant little logo
  • better copywriting on the readme page
  • proper hexdoc documentation, instead of a wall of text
  • hex/CI badges

Any other ideas welcome!

Ecto 2 Allowances for TestingAdapter

When upgraded a Phoenix project to Ecto 2.0-beta.2 we see the following error in our mailer tests:

** (RuntimeError) cannot find ownership process

There are two solutions to this issue, as documented in Ecto.Adapters.SQL.Sandbox.

For now we're using Shared mode, which works but runs the mailer tests synchronously. To have all the tests run concurrently, we could use Allowances in TestingAdapter:

defmodule Mailman.TestingAdapter do
  @moduledoc "Implementation of the testing SMTP adapter"

  def deliver(config, _email, message) do
    parent = self() # PID of the parent process
    Task.async fn ->
      Ecto.Adapters.SQL.Sandbox.allow(TestRepo, parent, self()) # need MyApp.Repo
      if config.store_deliveries do
        Mailman.TestServer.register_delivery message
      end
      { :ok, message }
    end
  end

end

We've tested this out, but with the name of our Repo hard coded. Do you think it would be possible to get this working?

CC/BCC emails aren't sent

This may be related to gen-smtp/gen_smtp#11 – CC'ed emails show up in the header but aren't being sent, and BCC'ed addresses are ignored entirely.

Am I doing it wrong? Is this an issue with the mailserver I'm using? Please enlighten me!

(Other than that, 100 × thank you for this amazing library!)

Moving to organization based repo

@skosch @Ch4s3

I figured that keeping the project under my account could be misleading as to the origins of efforts from now on. Because of this, I've just created a new organization in GitHub for the project and invited you both: mailman-elixir.

The repo has been cloned over there and lives at: https://github.com/mailman-elixir/mailman

Could you please make sure you have the needed access? It's becoming our baby from now on :)

Certain circumstances crash from Mailman.Email.parse!

Greetings,

I get this crash
:load_failed, 'Failed to load NIF library: 'priv/eiconv_nif.so: cannot open shared object file: No such file or directory''
from Mailman.Email.parse!
But only when I run the program as an escript. If I start 'iex -S mix' and call Mailman.Email.parse! from the shell it is okay.

  • mailman 0.4.0 (https://github.com/mailman-elixir/mailman.git) (mix)
    locked at 7c20dad
  • eiconv 1.0.0 (Hex package) (rebar3)
    locked at 1.0.0 (eiconv) ee1e47ee
    elixir --version
    Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
    Elixir 1.6.5 (compiled with OTP 19)

Mine is a very simple program and I have a workaround. So not really an issue, this is a FYI.

Code style cleanup (credo + dialyxir)

It would be nice to include linting and type checking via credo and @spec, and to bring the code in line with conventional Elixir code formatting while we're at it.

PRs welcome!

Error when parsing email without attachment info

I get this error when trying to parse an email without attachment info:

Example email: https://gist.github.com/fabiokr/13639921d958d3949cfb

** (exit) an exception was raised:
    ** (ArgumentError) argument error
        lib/mailman/parsing.ex:58: Mailman.Parsing.filename_from_raw/1
        lib/mailman/parsing.ex:74: Mailman.Parsing.is_raw_attachement/1
        (elixir) lib/enum.ex:704: anonymous fn/3 in Enum.filter/2
        (elixir) lib/enum.ex:1387: Enum."-reduce/3-lists^foldl/2-0-"/3
        (elixir) lib/enum.ex:704: Enum.filter/2
        lib/mailman/parsing.ex:89: Mailman.Parsing.get_attachments/1
        lib/mailman/parsing.ex:17: Mailman.Parsing.parse/1
        lib/mailman/parsing.ex:5: Mailman.Parsing.parse/1
        lib/mailman/parsing.ex:26: Mailman.Parsing.parse!/1

Deprecated Httpotion

Httpotion is now deprecated. It's a shame to have this dependency in Mailman. Any chance to remove it with something that's still maintained.

Even better would be to make the attachement downloading module (or function) configurable.

Argument error with elixir 1.11.4

I updated elixir to version 1.11.4, and since then I have the following error:

** (ArgumentError) argument error
:erlang.split_binary('250-PR0P264CA0221.outlook.office365.com Hello [37.157.224.248]\r\n', 3)
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/binstr.erl:114: :binstr.substr/3
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:623: :gen_smtp_client.read_possible_multiline_reply/1
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:488: :gen_smtp_client.try_EHLO/2
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:549: :gen_smtp_client.do_STARTTLS/2
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:520: :gen_smtp_client.try_STARTTLS/3
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:259: :gen_smtp_client.open_smtp_session/2
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:200: :gen_smtp_client.try_smtp_sessions/3
(gen_smtp 0.14.0) /app/deps/gen_smtp/src/gen_smtp_client.erl:189: :gen_smtp_client.send_it/2
(mailman 0.4.2) lib/mailman/external_smtp_adapter.ex:17: Mailman.ExternalSmtpAdapter.deliver/3

These compiling warnings should be resolved, thanks.

==> mailman
warning: the dependency :mailman requires Elixir "~> 1.0.0" but you are running on v1.3.3
Compiling 17 files (.ex)
warning: redefining @doc attribute previously set at line 3
lib/mailman.ex:8: Mailman (module)

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/parsing.ex:89

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/parsing.ex:111

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/parsing.ex:115

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/parsing.ex:119

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/render.ex:95

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/render.ex:119

warning: parentheses are required when piping into a function call. For example:

foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
lib/mailman/render.ex:111

warning: redefining @doc attribute previously set at line 8
lib/mailman.ex:13: Mailman (module)

Generated mailman app

`Mailmain.Email.parse!` usage

I am trying to get a very simple example of the email parsing working, here is my code:

def parse_test() do
  email = """
  Message-Id: <[email protected]>
  From: Micah Warren <[email protected]>
  To: [email protected]
  Content-Type: text/plain;
    charset=US-ASCII;
    format=flowed
  Content-Transfer-Encoding: 7bit
  X-Smtp-Server: mail.fusedsolutions.com:[email protected]
  Subject: Plain text only
  Date: Mon, 1 Jun 2009 14:50:15 -0400

  This message contains only plain text.
  """

  Mailman.Email.parse!(email) |> IO.inspect()
end

And here is the output:

%Mailman.Email{
  attachments: [], 
  bcc: [], 
  cc: [], 
  data: %{}, 
  delivery: "",
  from: "", 
  html: "", 
  reply_to: "", 
  subject: "",
  text: "<the whole email is here>",
  to: []
}

I am trying to figure out why the headers are not being parsed correctly. I have tried many iterations and have been unable to get the parse! function to do anything beside for returning the empty defaults.

Any example of using a Third Party SMTP server?

I'm interested in using Google's SMTP server as I'm not able to run one locally. Can an example be provided for hooking into a third-party SMTP ? I tried exploring the codebase, but I'm relatively new to Elixir, too.

Thanks!

Upgrade to Elixir 1.0, Hexify

Hi!

This is very interesting code. Please do some maintenance with catching up todays state-of-the-art stuff: Elixir 1.0.x line, Hex ..etc.

cheers :]

Wojtek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.