mailman icon indicating copy to clipboard operation
mailman copied to clipboard

`Mailmain.Email.parse!` usage

Open TylerPachal opened this issue 6 years ago • 0 comments

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.

TylerPachal avatar Oct 16 '18 15:10 TylerPachal