Send email: Difference between revisions

m
→‎{{header|Diego}}: added Diego entry
m (→‎{{header|Phix}}: added syntax colouring, marked p2js incompatible)
m (→‎{{header|Diego}}: added Diego entry)
Line 434:
end;
</lang>
 
=={{header|Diego}}==
<lang diego>
This <code>instruct</code>ion instructs a thing in the mist to send an email. It understands that the found <code>thing</code> will have microphone knowledge. If the caller does not have email knowledge (similar to libraries in other languages), the callee will train the caller on first request. It is at the discretion of the callee to adjust, delay or not send the email.
<lang diego>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.invalic)
_subject(Rosettacode wants me to send an email!)
_msg(This is the body of my email.)
_htmlmsg(&lt;b&gt;This is the body of my email, in bold&lt;/b&gt;)
_login[mycred]
_me();
 
reset_namespace();</lang>
 
=={{header|Emacs Lisp}}==