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.

E-mail backup file
#39
Hello All,

I am trying to figure out how to send the backup file to more than one recipients using this script without success.

How would this part of the script look like if I want to send the mail to two, three ... recipients?

Code:
--Recipient for e-mail
to = 'example@hotmail.com'
alias_to = ''

--Subject for e-mail
subjectpart1 = 'MainSL Back-up file'
subjectpart2 = ''

image_description = 'Backup from MainSL'

--Message on bottom of email (will only be showed when client don't understand attachment)
epilogue = 'End of message'

--***********************************************************--
--******************** End of parameters ********************--
--***********************************************************--
--********** DON'T CHANGE ANYTHING UNDER THIS LINE **********--
--***********************************************************--

--Create table to include mail settings
local settings = {
    from = from,
    rcpt = to,
    user = user,
    password = password,
    server = 'smtp-mail.outlook.com',
    port = 587,
    secure = 'starttls',
}

--Create attachment
src = 'MainSL_backup-' .. os.date('%Y.%m.%d') .. '.tar.gz'
dst = '/home/ftp/' .. src

-- prepare files for backup
os.execute('sh /lib/genohm-scada/web/general/backup.sh')

-- create archive
os.execute('cd /lib/genohm-scada/storage && tar -c -z -f ' .. dst .. ' ./')

--Create subject
subject = subjectpart1 .. ": " .. src .. " " .. subjectpart2

--Load required modules to send email with attachment
local smtp = require("socket.smtp")
local mime = require("mime")
local ltn12 = require("ltn12")

--Create e-mail header
settings.source = smtp.message{
headers = {
          from = '' .. alias_from .. ' ' .. from .. '',
          to = '' .. alias_to .. ' ' .. to .. '',
          subject = subject
},

Any input on the solution would be apreciated.

Regards
Reply


Messages In This Thread
E-mail backup file - by JMM - 21.09.2016, 16:47
RE: E-mail backup file - by PassivPluss - 18.10.2016, 19:00
RE: E-mail backup file - by PassivPluss - 19.10.2016, 17:58
RE: E-mail backup file - by baggins - 08.11.2016, 22:32
RE: FTP backup file - by Dré - 04.01.2022, 16:07
RE: E-mail backup file - by Dré - 22.03.2022, 14:30
RE: E-mail backup file - by PassivPluss - 26.10.2016, 20:42
RE: E-mail backup file - by npinguin - 15.11.2016, 20:16
RE: E-mail backup file - by admin - 16.11.2016, 07:30
RE: E-mail backup file - by baggins - 16.11.2016, 08:55
RE: E-mail backup file - by admin - 16.11.2016, 09:11
RE: E-mail backup file - by npinguin - 16.11.2016, 18:51
RE: E-mail backup file - by admin - 17.11.2016, 07:21
RE: E-mail backup file - by JMM - 27.07.2017, 15:40
RE: E-mail backup file - by mlaudren - 27.07.2017, 21:55
RE: E-mail backup file - by DGrandes - 15.10.2018, 10:21
RE: E-mail backup file - by Daniel - 15.10.2018, 10:47
RE: E-mail backup file - by DGrandes - 16.10.2018, 07:37
RE: E-mail backup file - by admin - 16.10.2018, 10:26
RE: E-mail backup file - by DGrandes - 16.10.2018, 10:46
RE: E-mail backup file - by pioneersteffen - 31.10.2021, 10:44
RE: E-mail backup file - by Daniel - 01.11.2021, 08:36
RE: E-mail backup file - by pioneersteffen - 02.11.2021, 18:28
RE: E-mail backup file - by admin - 04.01.2022, 16:13
RE: E-mail backup file - by Dré - 04.01.2022, 16:45
RE: E-mail backup file - by icuzz - 09.02.2022, 16:21
RE: E-mail backup file - by admin - 10.02.2022, 08:15
RE: E-mail backup file - by icuzz - 10.02.2022, 12:38
RE: E-mail backup file - by admin - 22.03.2022, 14:31
RE: E-mail backup file - by Dré - 22.03.2022, 15:20
RE: E-mail backup file - by manos@dynamitec - 24.11.2022, 03:01
RE: E-mail backup file - by admin - 24.11.2022, 07:52
RE: E-mail backup file - by manos@dynamitec - 24.11.2022, 09:34
RE: E-mail backup file - by admin - 24.11.2022, 09:38
RE: E-mail backup file - by manos@dynamitec - 25.11.2022, 08:27
RE: E-mail backup file - by admin - 25.11.2022, 15:42
RE: E-mail backup file - by manos@dynamitec - 07.12.2022, 20:01
RE: E-mail backup file - by admin - 08.12.2022, 07:35
RE: E-mail backup file - by manos@dynamitec - 09.12.2022, 12:16

Forum Jump: