This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

send mail from gmail
#7
Hi,

I have seen projects that are using a backup with older common function and that was the problem with mail..

Check if the function mail is like below:

Code:
-- send an e-mail function mail(to, subject, message)   -- make sure these settings are correct   local settings = {     -- "from" field, only e-mail must be specified here     from = 'user@gmail.com',     -- smtp username     user = 'user@gmail.com',     -- smtp password     password = 'password',     -- smtp server     server = 'smtp.gmail.com',     -- smtp server port     port = 465,     -- enable tls, required for gmail smtp     secure = 'tlsv1_2',   }   local smtp = require('socket.smtp')   if type(to) ~= 'table' then     to = { to }   end   for index, email in ipairs(to) do     to[ index ] = '<' .. tostring(email) .. '>'   end   -- fixup from field   local from = '<' .. tostring(settings.from) .. '>'   -- message headers and body   settings.source = smtp.message({     headers = {       to = table.concat(to, ', '),       subject = subject,       ['From'] = from,       ['Content-type'] = 'text/html; charset=utf-8',     },     body = message   })   settings.from = from   settings.rcpt = to   res, err = smtp.send(settings)   return res,err end
BR,

Erwin
Reply


Messages In This Thread
send mail from gmail - by Angeles - 02.07.2020, 08:25
RE: send mail from gmail - by Daniel - 02.07.2020, 08:32
RE: send mail from gmail - by Angeles - 02.07.2020, 08:41
RE: send mail from gmail - by Daniel - 02.07.2020, 08:51
RE: send mail from gmail - by Angeles - 02.07.2020, 09:04
RE: send mail from gmail - by Daniel - 02.07.2020, 12:53
RE: send mail from gmail - by Erwin van der Zwart - 02.07.2020, 13:10
RE: send mail from gmail - by Krstfr2k - 03.07.2020, 13:20

Forum Jump: