View Categories

Configure a autoresponder to send a Multipart (HTML and Plaintext) email

2 min read

When setting up an MDaemon autoresponder it is often nice to be able to respond with formatted text in HTML.  However if this email is received by a client that can only read plain text then the response will show the HTML code and will be difficult to interpret.

The correct approach is to send back a multipart email that contains both a HTML version of the message as well as a Plain text version.
 
The template below can be used in MDaemon to send back a correctly formatted multipart message.

The first section contains hashed comments feel free to edit this as you like.

# Multipart sample auto-responder script
#
# Note: Lines beginning with # are comments
#
# This is an example script that demonstrates how to send
# an autoresponder message using a Multipart mail (HTML and Plain text).
#

This next section is the text version of the email with the correct content type:

–0304_0930_59_PART-BREAK
Content-Type: text/plain; charset=”us-ascii”

The body of the email in plain text:

simple HTML bold

This next line defines the end of this Mulitipart section

–0304_0930_59_PART-BREAK

This next section is the HTML version of the email with the correct content type:

Content-Type: text/html; charset=”us-ascii”

The body of the email in HTML:

<HTML>
<div><font style=”font-family: tahoma; font-size: 10pt;”>
<div><br />
&nbsp;simple HTML <strong>bold</strong></div>
</font></div>
</HTML>

This next line defines the end of this Mulitipart section:

–0304_0930_59_PART-BREAK–

The following two lines set the subject header to RE:(the original subject), and the message content type to Multipart:

%SetSubject%=RE: $SUBJECT$
%SetContentType%=multipart/alternative; boundary=”0304_0930_59_PART-BREAK”


In this example I used the part break value  0304_0930_59_PART-BREAK this is actually made up from the date and time of when the message was sent  “Month,day_Hour,Min_sec_PART-BREAK”.

This value has to be unique per message so it’s not a problem if you keep it as the example, or if you prefer you can change this to any valid date and time.