diff --git a/mail/compose_email.anubis b/mail/compose_email.anubis index 8fa9b58..f0883ec 100644 --- a/mail/compose_email.anubis +++ b/mail/compose_email.anubis @@ -331,6 +331,31 @@ public define String else encode_plain_text_content(split_lines(content), []) + crlf. +public define String + make_alternative + ( + String email_id, + String text_part_content, + String html_part_content + )= + if length(text_part_content) > 0 & length(html_part_content) > 0 then + //multipart alternative + with boundary = "=_alternative_"+email_id+"_=", + "Content-Type: multipart/alternative;" + crlf + + " boundary=\"" + boundary + "\"" + crlf + + crlf + + "--" + boundary + crlf + + text_part_content + crlf + + "--" + boundary + crlf + + html_part_content + crlf + + "--" + boundary + "--" + else if length(text_part_content) > 0 then + text_part_content + else + html_part_content + +. + public define String compose_mail @@ -338,24 +363,33 @@ public define String Email_to_send send ) = //with header_to_name = "To: ", - if send is data_to_send(from, to_list, cc_list, bcc_list, subject, content, files, send_copy, reply_to) then + if send is data_to_send(from, to_list, cc_list, bcc_list, subject, text_content, html_content, files, send_copy, reply_to) then with send_date = get_rfc822_date_format, - text_type = if find(" 0 then + "Content-Type: text/plain; charset=UTF-8" + crlf + + "Content-Transfer-Encoding: 8bit" + crlf + + crlf + + encode_content(text_content, false) + else + "", + data_html = if length(html_content) > 0 then + "Content-Type: text/html; charset=UTF-8" + crlf + + "Content-Transfer-Encoding: 8bit" + crlf + + crlf + + encode_content(html_content, true) + else + "", + body_text = make_alternative(email_id, data_text, data_html), + + is_multipart = if length(files) > 0 then true else false, +// is +// { +// [] then false, +// [h . t] then true +// }, - "Message-ID: " + to_ascii(sha1((from, send_date))) + crlf + + "Message-ID: " + email_id + crlf + "Date: " + send_date + crlf + // "From: " + user.login + "<" + user.login + "@" + domain + ">" + crlf + "User-Agent: Anubis XLib email sender" + crlf + @@ -380,19 +414,19 @@ public define String "Subject: " + to_folded_base64_text("UTF-8", subject) + crlf ) + if is_multipart then - with boundary = to_ascii(sha1((from, send_date))), + with boundary = "=_mixed_"+email_id+"_=", "Content-Type: multipart/mixed;" + crlf + " boundary=\"" + boundary + "\"" + crlf + crlf + "This is a multi-part message in MIME format." + crlf + "--" + boundary + crlf + - data_text + crlf + + body_text + crlf + data_files_multipart(files, boundary) + "--" + boundary + "--" else - data_text + body_text . diff --git a/mail/types/generated/email_to_send.anubis b/mail/types/generated/email_to_send.anubis index fbf89ff..d404abb 100644 --- a/mail/types/generated/email_to_send.anubis +++ b/mail/types/generated/email_to_send.anubis @@ -1,4 +1,4 @@ -/* +/* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) * Date: 2020-04-01 @@ -10,8 +10,8 @@ transmit system/muscle.anubis transmit system/convert.anubis transmit tools/basis.anubis -transmit types/generated/file_ref.anubis -transmit types/generated/email_address.anubis +transmit calexium_lib/types/generated/file_ref.anubis +transmit calexium_lib/mail/types/generated/email_address.anubis -- libgit2 0.21.4