Send rich HTML email

Introduction

This example shows how to use the mime.lua module to send MIME-encoded email attachments using the SMTP protocol by using a wrapper around net.smtp.send. The mime.lua module contains a function mime.send() that is a wrapper around net.smtp.send() with an added attachments parameter.

If you have any questions please contact us at support@interfaceware.com.

Using the Code [top]

  • Import the Send rich HTML email channel from the Builtin: Iguana Tools repository
  • Experiment with the code to find out how it works
  • Then add the module to your Translator project
  • Copy the require statement from the channel and add it at the top of your script
    Note: This module uses require to return a table
  • Adapt the code to your own requirements
  • Call mime.send() using your smtp parameters
  • Interactive scripting help is included for this module

This is the github code for the main module:

How it works [top]

Even though the net.smtp documentation does not explicitly mention MIME or attachments, sending files as attachments is simply a process of formatting the body of the SMTP message with both MIME headers and encoded attachment contents.

Using this method the mime.lua module provides the mime.send() function that wraps net.smtp.send() and provides an added attachments parameter.

More information [top]

 

Tagged:

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.