ESP32 Sends an email

Поділитися
Вставка
  • Опубліковано 23 гру 2022
  • Let's send an email from our Adafruit ESP32-S2 TFT Feather.
    This script will send an email to Gmail and then on to your final destination. We will configure Gmail to securely accept the email, without having to enter a password every time, and forward it to a mail box.
    Original code and documentation:
    randomnerdtutorials.com/esp32...
    My Github repository with the TFT tweaked code:
    github.com/bdash9/ESP32-TFT-e...
    Wokwi web based UI to code on a ESP32:
    wokwi.com/projects/3224107315...
    I am using the Adafruit ESP32-S2 TFT feather:
    www.adafruit.com/product/5300

КОМЕНТАРІ • 20

  • @longhuynh7306
    @longhuynh7306 Рік тому

    thank you i have been studying this technique since the afternoon starting from zero but i did not give up and i did. All thanks to your video explaining everything

    • @dash9computing
      @dash9computing  Рік тому

      Great job! I am so glad my video helped. Isn't it a great feeling when you get something like this working? :)

  • @bumpin2098
    @bumpin2098 Рік тому

    getting a device with esp32 on it and it looks like fun!

  • @altitude1039
    @altitude1039 Рік тому

    Thanks for sharing this. I have been working on a project using esp-now, and Callmebot. I was originally going to use an email to SMS, but but is was too complicated. The Callmebot sends a message to my phone via Signal when my garage door opens.

    • @dash9computing
      @dash9computing  Рік тому +1

      Glad it was helpful! I like the sound of your project. Have you posted it anywhere?
      I have never used Callmebot but I want to now! If anyone else is interested I think this is useful:
      www.callmebot.com/blog/free-api-whatsapp-messages/

    • @altitude1039
      @altitude1039 Рік тому

      @@dash9computing ​ I haven't got it working the way I would like it, so not yet available to the public. Callmebot works for Signal, Telegram + whatsapp. Message usually arrives in less than ten seconds

  • @KyrychenkoAnton
    @KyrychenkoAnton Рік тому

    Hi, I wonder if its possible to self-host email server on esp32 kind of board, didn't you try it? I mean not to send email to existing gmail email server, but receive - say you have static ip address and bought domain name - does esp32 have enough ram to host email server so I can connect to it later with bluetooth and get those emails?..

    • @dash9computing
      @dash9computing  Рік тому +1

      Interesting project idea! I have only used it as a mail relay as i don't have a SD module. I think you would want the storage unless you are only holding small mail messages. You can write to the file system with FS, tinyFS or SPIFFS (those are the ones I have used, I bet there are more). If you try this, can you send me a link to the code? :)

    • @KyrychenkoAnton
      @KyrychenkoAnton Рік тому

      @@dash9computing Sorry, I'm not very familiar with esp's, I'm currently making other thing on rp2040, and not sure will have time for such experiments at the time). My interest comes from dumb idea I have to host all my emails in a smartwatch with lte e-sim internet - so that all your emails and passwords are always on your wrist.

    • @dash9computing
      @dash9computing  Рік тому +1

      Ah, sorry! I have the ESP32 on the brain! I think it is a cool idea. The memory capacity will be the issue. If you are thinking of building a smart watch the SD expansion might make it bulky.

    • @KyrychenkoAnton
      @KyrychenkoAnton Рік тому

      @@dash9computing yeah, sure. Although I guess micro sd SDIO card reader I used is like 2 mb 3 mm in height, not that much. I even saw some watches with sd cards for lte

    • @dash9computing
      @dash9computing  Рік тому

      It sure would be nice to have that storage. I had a Liligo T-Watch 2020 v3 (ESP32 based). It was a little thick with the case but not bad.

  • @dwurm5688
    @dwurm5688 11 місяців тому

    I want to trigger the e-mail to be sent based on an event in which a normally closed circuit is in it's open state. For example, every time my mailbox is opened once a day, the closed circuit is broken and becomes in an open state. I'm a bit of a newbee, so if you could please tell me the code I need and exactly where it goes in the sketch. I also need to know which pins to attach the circuit to. So sorry, I'm just getting started in this.

    • @dwurm5688
      @dwurm5688 11 місяців тому

      Maybe I could accomplish more simply the same goal by setting up a relay that will power on the device when the mailbox is opened?

    • @dwurm5688
      @dwurm5688 10 місяців тому

      I figured it out by myself... Did it without setting up a relay as mentioned before. Anyone wanting to know how, please ask.

    • @dash9computing
      @dash9computing  8 місяців тому

      Hi, sorry I didn't reply! Glad you figured it out!

  • @qduynguyen7407
    @qduynguyen7407 Рік тому

    Hello, thank you for sharing your video. Could you help me with my code? This example only send the email in setup, so it's only once. How would I add a sensor and get an email from a triggered? I added 'initiating smtp connection and send message' codes to the loop, the program compiled but would not send any email. Could you advise? Thank you in advance.

    • @dash9computing
      @dash9computing  Рік тому

      My last reply may have been interrupted....just in case...
      void loop(){
      // Read the sensor value and store it in a variable
      int sensorValue = analogRead(A0);
      // Check if the sensor value is above a certain threshold
      if(sensorValue > 500){
      // Declare the session config data
      ESP_Mail_Session session;
      // Set the session config
      session.server.host_name = SMTP_HOST;
      session.server.port = SMTP_PORT;
      session.login.email = AUTHOR_EMAIL;
      session.login.password = AUTHOR_PASSWORD;
      session.login.user_domain = "";
      // Declare the message class
      SMTP_Message message;
      // Set the message headers
      message.sender.name = "ESP";
      message.sender.email = AUTHOR_EMAIL;
      message.subject = "ESP Test Email";
      message.addRecipient("Ben", RECIPIENT_EMAIL);
      // Send HTML message
      String htmlMsg = "Hello Ben!- Sent from ESP32-S2 board";
      message.html.content = htmlMsg.c_str();
      message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
      // Connect to server with the session config
      if (!smtp.connect(&session))
      return;
      // Start sending Email and close the session
      if (!MailClient.sendMail(&smtp, &message))
      tft.println("Error sending Email, " + smtp.errorReason());
      }
      // Delay for a short time before checking the sensor again
      delay(1000);
      }

    • @qduynguyen7407
      @qduynguyen7407 Рік тому

      @@dash9computing Oh so we put the entire setup in the loop; and also in the setup?. Thank you so much. I'll give it a try and check back.

    • @dwurm5688
      @dwurm5688 10 місяців тому

      Done with only 5 new lines of code...
      #include
      #include
      ezButton button(8); // create ezButton object that attach to pin 22;
      ___________________________________________________
      void setup()
      {
      start: // GoTo Label Name
      button.loop(); // MUST call the loop() function first
      int btnState = button.getState();
      Serial.println(btnState);
      if (btnState == 1) // Checks to see if Circuit is open
      {
      goto start; // If not open (closed circuit) and continue
      } // Note: close loop by connecting A5 (pin 8) to GRD ground
      _________________________________________________________
      /* Start sending Email and close the session */
      if (!MailClient.sendMail(&smtp, &message))
      tft.println("Error sending Email, " + smtp.errorReason());
      goto start; // This will loop back up and restart process
      }
      void loop(){
      //Add Ben
      // turn on backlite@@dash9computing