This script sends the clipboard as HTML to an outgoing mail SMTP server (without SSL).
You can use the "Edit > Copy" or "Edit > Copy as HTML" command to set the clipboard.
EDIT: added HTML tag
Is there a way to copy the entire buffer as HTML from a script?
reference:
Communicating with the Internet (with LuaSocket)
http://www.gammon.com.au/forum/?id=8319
LuaSocket SMTP
http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/smtp.html
You can use the "Edit > Copy" or "Edit > Copy as HTML" command to set the clipboard.
local s = GetClipboard()
if not string.match(s, "Produced by MUSHclient") then
s = '<pre><font size=2 face="Fixedsys">' .. FixupHTML(s) .. "</font></pre>"
end
local smtp = require("socket.smtp")
local r, e = smtp.send {
from = "<sender@example.com>",
rcpt = "<recipient@example.com>",
source = smtp.message {
headers = {
from = "MUSHclient " .. GetInfo(72),
subject = GetInfo(2),
to = GetInfo(3),
["content-type"] = 'text/html; charset="us-ascii"'
},
body = '<html><body bgcolor="#000000" text="#C0C0C0">' .. s .. "</body></html>"
},
server = "smtp.example.com",
port = "25"
}
if r then
AnsiNote("\\n" .. ANSI(33) .. "Mail Sent")
elseif e then
AnsiNote("\\n" .. ANSI(33) .. "Error: " .. e)
endIs there a way to copy the entire buffer as HTML from a script?
reference:
Communicating with the Internet (with LuaSocket)
http://www.gammon.com.au/forum/?id=8319
LuaSocket SMTP
http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/smtp.html