diff website/src/examples/upload-and-email.html.luan @ 1589:0c46edec25dd

mail work
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 13 Mar 2021 21:02:38 -0700
parents 13135e289b50
children 92860f763715
line wrap: on
line diff
--- a/website/src/examples/upload-and-email.html.luan	Fri Mar 12 23:47:17 2021 -0700
+++ b/website/src/examples/upload-and-email.html.luan	Sat Mar 13 21:02:38 2021 -0700
@@ -3,7 +3,7 @@
 local Mail = require "luan:mail/Mail.luan"
 
 
-local send = Mail.Sender{
+local send = Mail.sender{
 	host = "smtpcorp.com"
 	username = "smtp@luan.software"
 	password = "luanhost"
@@ -46,11 +46,19 @@
 	else
 		local file = Http.request.parameters.file
 		send{
-			from = "smtp@luan.software"
-			to = email
-			subject = "Upload and Email"
-			body = "file should be attached"
-			attachments = {file}
+			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