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]
- Source code for the main module on github
- Source code for the mime.lua module on github
- API documentation for iguana.project.root