local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Mail = require "luan:mail/Mail.luan" local send = Mail.sender{ host = "smtpcorp.com" username = "smtp@luan.software" password = "luanhost" port = 2525 }.send local function form() %>

Upload and Email

Email:

<% end local function sent() %>

Upload and Email

file sent

<% end return function() Io.stdout = Http.response.text_writer() local email = Http.request.parameters.email if email == nil then form() else local file = Http.request.parameters.file send{ From = "smtp@luan.software" To = email Subject = "Upload and Email" body = { { body = "file should be attached" } { ["Content-Type"] = file.content_type ["Content-Disposition"] = [[attachment; filename="]]..file.filename..[["]] body = file.content } } } sent() end end