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.

LM and PDF?
#7
Hi Admin,

It's not quite clear for me how I can implement HTML text with variable text into the Message


Code:
    -- adjustable information

AantalECG = 189                                              -- Aantal armaturen                             
MainEmail = 'example@example.be'                              -- mailadres voor main email
Subject = '72.01 resultaat functietest_'  ..os.date('%F , %X')            -- Onderwerp email
Message = '72.01 resultaat functietest op '  ..os.date('%F , %X')        -- Bericht in email
Filename = os.date("%y%m%d")..'_72.01_functietest.csv'                -- Naam voor csv-bestand
FINummer = 72.01                                                                                                        -- FI nummer van het gebouw

   -- get current data as table
now = os.date('*t')
   
current_hourandseconds = string.format("%02d", now.hour)  .. ":" .. string.format("%02d", now.min)
current_date = string.format("%02d", now.day) .. "-" .. string.format("%02d", now.month) .. "-" .. now.year



-- HTML text to implement in Message

htmldata = [[<html style="font-family:Arial">
<body>

  <h1>]] ..FINummer.. [[ Attest functietest </h1>

<p>Beste,</p>
  <p>Hierbij bevestigen wij u dat op ]] .. current_date .. [[ om ]] .. current_hourandseconds .. [[ uur een functietest van de veiligheidsverlichting voor het gebouw met FI-nummer ]] ..FINummer.. [[ werd uitgevoerd.</p>
  <p>De resultaten van deze functietest zijn opgenomen als bijlage: ]] ..Filename.. [[ van een mail verzonden vanaf example@example.be.</p>
 
  <table style="width:100%">
    <tr>
        <td><b>Aantal armaturen</b></td>
        <td><b>Resultaat</b></td>
    </tr>
    <tr>
  <td>]] .. AantalECG.. [[</td>
    <td>]] ..FINummer.. [[</td>
    </tr>
</table>


<p>Wanneer u vragen heeft over het testrapport kunt u contact opnemen met example@example.be.</p>
<p>Dit rapport is verzonden op ]] .. current_date .. [[ om ]] .. current_hourandseconds .. [[ uur.</p>
</body>
</html>]]

-- Sending main email

  res, err = mailattach(MainEmail, Subject, Message , Filename, csv, 'text/csv')
  log(res, err,'main email sent') 

    script.disable(_SCRIPTNAME) 
    end
Gr.
Geert
Reply


Messages In This Thread
LM and PDF? - by MarcusH - 13.11.2019, 08:05
RE: LM and PDF? - by Erwin van der Zwart - 13.11.2019, 15:50
RE: LM and PDF? - by MarcusH - 14.11.2019, 06:25
RE: LM and PDF? - by Erwin van der Zwart - 14.11.2019, 08:56
RE: LM and PDF? - by Fahd - 05.05.2023, 07:09
RE: LM and PDF? - by Geert - 15.03.2020, 15:49
RE: LM and PDF? - by admin - 16.03.2020, 09:51
RE: LM and PDF? - by Geert - 19.03.2020, 09:35
RE: LM and PDF? - by admin - 19.03.2020, 10:32
RE: LM and PDF? - by Geert - 19.03.2020, 10:44
RE: LM and PDF? - by admin - 19.03.2020, 11:36
RE: LM and PDF? - by Geert - 19.03.2020, 16:41
RE: LM and PDF? - by admin - 05.05.2023, 07:14
RE: LM and PDF? - by Fahd - 05.05.2023, 07:22
RE: LM and PDF? - by admin - 05.05.2023, 07:25
RE: LM and PDF? - by Fahd - 05.05.2023, 07:30

Forum Jump: