Send a simple mail including the value of a declared variable in the message

Home Forums The libraries hosted on the site EMailSender send email with attachments Send a simple mail including the value of a declared variable in the message

Viewing 4 reply threads
  • Author
    Posts
    • #4849
      Mario Sabransky

        Good morning people!

        I am new in Arduino word and I am using with great success the EmailSender library.

        Thanks a lot for your work!

        Now I am not success trying to send the value of a variable obtained from the Esp8266 sketch using the simple email sender. (my project do not have SD support).

        I need to send a message with a welcome text (like your examples), but including the value of a variable from the sketch routine.

        Could someone help me?

        Thank you very much and have a nice time.

        Greetings.

        Mario

         

      • #4885
        Renzo Mischianti
        Keymaster

          Hi Mario,

          I put a piece of my Inverter monitor where I send a set of value via mail when there is a problem

          EMailSender::EMailMessage message;
          const String sub = F("Inverter error!"); // Here the subject
          message.subject = sub;

          const String mp = F("Error on inverter centraline");
          const String ft = (fixedTime)?F("OK"):F("NO");
          const String sd = (sdStarted)?F("OK"):F("NO");
          const String wc = (wifiConnected)?F("OK"):F("NO");
          const String sf = (isFileSaveOK)?F("OK"):F("NO");

          // Here the message in html format
          message.message = mp+
          F("<br>Time fixed: ")+ft+
          F("<br>SD Initialized: ")+sd+
          F("<br>Wifi Connecter :P: ")+wc+
          F("<br>Saving file ok: ")+sf+
          F("<br>Wrong saving attempts: ")+sdWrongReadNumber;

          EMailSender::Response resp = emailSend.send(emailToSend, message);

          The result is

          Error on inverter centraline
          Time fixed: OK
          SD Initialized: OK
          Wifi Connecter :P: OK
          Saving file ok: NO
          Wrong saving attempts: 10

           

          Bye Renzo

        • #4923
          Mario
          Participant

            Hi Renzo.

            Thank you very much for your clear and didactic example.
            It has allowed me to understand in a minute how to solve my problem.
            At the same time, it helps me to see in which area should I focus my study.
            I am very excited.
            Have a nice day.

          • #7475
            mohammed alsuhbani
            Participant

              Hi Renzo

              can you tell me What type of this variable is ( sdWrongReadNumber ) in  this code or send to me the code ,

              Because I am trying to send, via email, a variable that contains a number, but I was not able, so I tried a byte variable, and also, did it work, because the program considered the code wrong

              thank you very much

            • #7478
              Renzo Mischianti
              Keymaster

                Hi Mohammed,

                I use this declaration

                uint8_t sdWrongReadNumber = 0;

                You can find the complete sketch of the Power One aurora Inverter at this link.

                GitHub repository of ABB Aurora inverter web interface.

                If you need more info, ask.

                Bye Renzo

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.
            Exit mobile version