do_sendmail(EmailAttrs) ->
     M = boss_record:new(mail, EmailAttrs),
     {ok, EMail} = M:save(),
     boss_mail:send_template(myapp, notification, [EMail]).

2016-01-27 12:17 GMT+08:00 chan sisowath <[email protected]>:

> hi,
>
>  i have this from an app i have done before.
>  not sure how it behave now with latest CB.
>
> ail
> ├── view
> │   ├── notification.html
> │   └── notification.txt
> ├── myapp_mail_incoming_mail_controller.erl
> └── myapp_mail_outgoing_mail_controller.erl
>
> -module(myapp_mail_outgoing_mail_controller).
> -export ([notification/1]).
>
> notification(Email) ->
>     {
>      ok,
>      Email:from(),
>      Email:to(),
>      Email:headers(),
>      Email:attributes(),
>      [{charset, "utf-8"}]
>     }.
>
> %%% ----- mail model
> -module(mail, [Id,
>                FromName,
>                From,
>                To,
>                ToName,
>                Subject,
>                Message,
>                Html,
>                DateCreated,
>                Charset,
>                Lang
>                ]).
>
> -define (MAIL_FROM, "[email protected]").
> -define (MAIL_NAME, "MYDOMAIN Mail System").
>
> -export([humanize_from/0]).
> -export([b64_subject/0]).
> -export([headers/0]).
>
> humanize_from() ->
>     case THIS:from_name() of
>         undefined -> THIS:from();
>         Name      -> string:join ([Name, " <", THIS:from(), ">"], "")
>     end.
>
> b64_subject() ->
>     SubjB64 = base64:encode_to_string (THIS:subject()),
>     string:join(["=?UTF-8?B?", SubjB64, "?="], "").
>
> headers() ->
>   [
>    {              "To", THIS:to()},
>    {            "From", THIS:humanize_from()},
>    {         "Subject", THIS:b64_subject()},
>    %{"Content-Language", THIS:lang()},
>    {    "Content-Type", "text/plain; charset=UTF-8"}
>   ].
>
> here the basic call to send the mail:
>
> do_sendmail(EmailAttrs) ->
>      M = boss_record:new(mail, EmailAttrs),
>      {ok, EMail} = M:save(),
>      boss_mail:send_template(vikvon_mail, notification, [EMail]).
>
> mihawk.
>
>
>
>
>
> 2016-01-27 7:14 GMT+08:00 Mert Öztürk <[email protected]>:
>
>> Hello Angel,
>>
>> Yes i made it. Just struggling to pass values from controller to html
>> form with django template but still could not succeeded.
>> Could not find any implementation done before.
>>
>> Thanks
>> Mert
>>
>>
>> 18 Ocak 2016 Pazartesi 09:15:02 UTC+2 tarihinde Ángel Herranz yazdı:
>>>
>>> You just need the template foo_message.html in directory src/mail/view.
>>> Did you try it?
>>>
>>> El miércoles, 6 de enero de 2016, 22:16:47 (UTC+1), Mert Öztürk escribió:
>>>>
>>>> Hello,
>>>>
>>>> I succeed integrating mandrill smtp api and mailing plain text with "
>>>> smtp.mandrillapp.com" but could not find any source or example using
>>>> templates through ChicagoBoss.
>>>> Read Chicagoboss documentation but couldn't understand ----> 
>>>> boss_mail:send_template(my_application,
>>>> foo_message, [Arg1, Arg2, ...])
>>>> foo_message is the function in myapp_outgoing_mail_controller.erl with
>>>> the variables Arg1,Arg2.. but still couldnt understand how to get content
>>>> from view folder and where to put sender and recipent??
>>>> Is there any example of using .html templates in my mail with dynamic
>>>> variables?
>>>>
>>>> Many thanks
>>>> Mert
>>>>
>>>> --
>> You received this message because you are subscribed to the Google Groups
>> "ChicagoBoss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> Visit this group at https://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/chicagoboss/e9c1dd4c-f39e-47e3-8e67-24466445cb69%40googlegroups.com
>> <https://groups.google.com/d/msgid/chicagoboss/e9c1dd4c-f39e-47e3-8e67-24466445cb69%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CAB-OfhnkkEH5aKV_rQmNNFqT%3DBbqha66GvZwn6jZoFKgRGur-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to