私はubuntu 10.10で作業しており、Erlangを使用しています。
私の目標は、Erlang からメールを送信するためのコードを書くことです。
これは私のコードです:
-module(mailer).
-compile(export_all).
send(Destination, Subject, Body) ->
D = string:join(lists:map( fun(Addr) -> binary_to_list(Addr) end, Destination ), " " ),
S = io_lib:format("~p",[binary_to_list(Subject)]),
B = io_lib:format("~p",[binary_to_list(Body)]),
os:cmd("echo "" ++ B ++ "" | mail -s "" ++ S ++ "" " ++ D).
そして、私が試す送信機能を実行するには:
Erlang R13B03 (erts-5.7.4) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.4 (abort with ^G)
1> mailer:send([<<"testFrom@mail.com">>, <<"testto@yahoo.fr">>], <<"hello">>, <<"Hello guys">>..
"/bin/sh: mail: not found\n"
ご覧のとおり、次のエラーがあります。
/bin/sh: mail: not found