Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Send-email/Diego/send-email.diego
Normal file
32
Task/Send-email/Diego/send-email.diego
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
begin_instruct(Send email)_param({str} from, to, cc, subject, msg, {html}, htmlmsg)_opt({cred}, login)_ns(rosettacode);
|
||||
set_thread(linger);
|
||||
find_thing()_first()_email()
|
||||
? with_found()_label(emailer);
|
||||
: exit_instruct[]_err(Sorry, no one can send emails!);
|
||||
;
|
||||
with_[emailer]_format(html)
|
||||
? with_[emailer]_cred[login]_email[htmlmsg]_from[from]_to[to]_cc[cc]_subject[subject];
|
||||
: exit_instruct[]_err(Something went wrong with the email);
|
||||
: with_[emailer]_cred[login]_email[msg]_from[from]_to[to]_cc[cc]_subject[subject];
|
||||
: exit_instruct[]_err(Something went wrong with the email);
|
||||
;
|
||||
reset_thread();
|
||||
end_instruct[];
|
||||
|
||||
set_namespace(rosettacode);
|
||||
|
||||
// Set up credentials
|
||||
add_var({cred}, mycred)_server(esvr1)_username(bob)_password(p@$$w0rd); // Other credentials can be added here
|
||||
|
||||
// Send email:
|
||||
exec_instruct(Send email)_param()
|
||||
_from(bob@bobmail.com.invalid) // It is at the discretion of the caller to use this from address
|
||||
_to(fred@bobmail.com.invalid)
|
||||
_cc(jill@bobmail.com.invalid)
|
||||
_subject(Rosettacode wants me to send an email!)
|
||||
_msg(This is the body of my email.)
|
||||
_htmlmsg(<b>This is the body of my email, in bold</b>)
|
||||
_login[mycred]
|
||||
_me();
|
||||
|
||||
reset_namespace();
|
||||
Loading…
Add table
Add a link
Reference in a new issue