Skip to main content

mailConvertFromMIME

mailConvertFromMIME( mimeblob : blob ) : object
mailConvertFromMIME( mimestring : string ) : object

ParameterTypeDescription
mimeblobblob->Email in MIME blob
mimestringstring->Email in MIME string
Resultobject<-Email object

Description

The mailConvertFromMIME command converts a MIME document into a valid email object.

QodlyScript follows the JMAP specification to format the returned email object.

Pass in mimeblob or mimestring a valid MIME document to convert. It can be provided by any mail server or application. If the MIME comes from a file, it is recommended to use a blob parameter to avoid issues related to charset and line break conversions.

Returned object

Email object.

Example

You want to load a mail template saved as MIME in a string document and send an email:

var mime: blob
var transporter : 4D.SMTPTransporter
var mail,server,status: object

mime = file("/PACKAGE/Mails/templateMail.txt").getContent())

mail = mailConvertFromMIME(mime)
mail.to = "smith@mail.com"
mail.subject = "Hello world"

server = newObject
server.host = "smtp.gmail.com"
server.port = 465
server.user = "test@gmail.com"
server.password = "XXXX"

transporter = 4S.SMTPTransporter.new(server)
status = transporter.send(mail)