Creating multipart HTML & text emails

According to the 4D manual, it suggests that it is possible using SMTP_Body, to create a multi part email with an HTML part and an optional text part, something which is a good practice to do.

The 4D manual states:

“To combine sending the message in HTML with a replacement option, you can just add together the values. For example, you can pass 1+4 in option to replace the body and send the message in HTML.”

Which suggests that you can send multi-part, HTML and Text emails, but there are no samples showing how to do this, and passing 1+4 in the options of SMTP does not accomplish this.>Product :4D - 4D Server

I am using 4D 17.

OS : Mac OS X

Hi,

Are you in 17.x or 17Rx ?

Patrick

I am using v17.1

I think you are misinterpreting the documentation, which, I must say, is a bit unclear.

one needs to take into account that 4D Internet Commands was created decades ago.

“append” in this context refers to the practice of passing HTML by piecemeal, since 4D had a 32K limit in string length before v11.

it has nothing to do with multiple MIME parts, as in multipart/alternative, with plain and HTML body.

Thank you. That makes sense. When it says “with a replacement option” it doesn’t mean an optional text or html part, but it means the text you pass will replace anything that is in the body.

From what I gather, there isn’t a simple way to create multi-part emails with the SMTP commands in 4D.

since MIME is only text, technically you can do it with string commands only

https://github.com/miyako/4d-component-email

but I agree, it seems not possible with Internet Commands.