[erlang-questions] esmtp: send PDF as an attachment

Amancio Díaz Suárez <>
Wed May 25 09:45:51 CEST 2011


Hi,


El mié, 25-05-2011 a las 00:23 +0200, Antoine Koener escribió:
> Some thoughts:
>
> On May 24, 2011, at 18:52 , Amancio Díaz Suárez wrote:
>
> > {ok, PngContent0} = file:read_file(?MAIL_PNG_LOGO),
> >    PngContent1 = base64:encode(PngContent0),
> >    PngContent = erlang:binary_to_list(PngContent1),
>
> Are you sure that you need to build a List ?
>

In the example PngContent1 is a binary, if I use it directly I got a
badarg:

Error calling [ EmailPdf ] Reason [ error ] Error [ badarg ] BackTrace
[ [{erlang,'++',[<<105,86....67,67>>,[13,10]]},
{esmtp_mime,encode_part,2},
{lists,map,2},
{lists,map,2},
{esmtp_mime,encode,1},
{esmtp,send,1}....


Building a list it works fine.

Amancio.










More information about the erlang-questions mailing list