I am having trouble figuring out how to send an html e-Mail using SecureSMTPClient. The e-Mail client always shows it as plaintext, which means that the MIME is not getting set, i.e. SecureSMTPClient forgets to send:
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
eventhough I specify text/html
.
Here is the code
title:='title1'.
content:='<a href="myurl">a link</a>'.
smtpClient := SecureSMTPClient new.
smtpClient user: senderMailAddress.
smtpClient password: pw.
smtpClient openOnHost: (NetNameResolver addressForName: 'smtp.gmail.com') port: 465.
message := MailMessage empty.
message setField: 'from' toString: senderMailAddress.
message setField: 'to' toString: rcvrAddress.
message setField: 'subject' toString: title.
msgBody:= MIMEDocument contentType: 'text/html' content: content.
message body: msgBody.
smtpClient mailFrom: senderMailAddress to: {rcvrAddress} text: message text.
smtpClient quit.
This question is related, however the answer depends on a class available in Pharo but not Squeak.