Sunday, September27, 2020
Privacy Policy

Sending emails with the ESP32-SIM800

It is the hard way but it works

I looked on Google for hours trying to find how to send emails with the ESP32-SIM800 from TTGO T-Call. The problem is that the unit is faulty and can't send emails. But we are sending emails from this little ESP32 to our home accounts. It is not straight forward and takes requires access to a server but it works.

The function that does work is the ability to read a web page and that is the function we used. We put the text for the email in the query field of the request to a special web page and had that page send the email to our home account. Simple, but you need access to a server running php. Luckily most all servers can do that. The required page is simple enough that you can likely get a friend to host it for you.

Here is the Arduino code which is a modified version of the code in the excellent tutorial HERE.

Arduino Code

      const char resource[] = "?password=myPassword&message=";
      String message = "GET ";
      message += resource;
      message += statusMessage;
      message += " HTTP/1.0\r\n";
      Serial.print("Message is ");
  // Make a HTTP GET request:
      client.print(String("Host: ") + server + "\r\n");
      client.print("Connection: close\r\n\r\n");
The server gets the following PHP code.

Server Code

     $password = trim(strip_tags($_REQUEST['password']));
     $message = trim(strip_tags($_REQUEST['message']));
     $headers = "From: ESP32-SIM800" . "\r\n";
     if($password == "myPassword"){
     mail ("", "Report", $message, $headers);
     mail ("", "ESP32 Report", $message, $headers);

     echo "Message sent";
     else {
	     echo "password incorrect <br>";
	     $message .= " password = " . $password;
	     mail ("", "ESP32 Report", $message, $headers);

Cookie Policy:
This website uses cookies to save your settings. No personal information is saved. I do not collect statistics on your visit. You can disable cookies in your browser if you like but it is not recommended for this site. I do not sell cookies. Go to a bakery for that. In fact I do not sell anything. To disable cookies from, please refer to the Help button in your browser.
Privacy Policy:
I do not sell or share any user data or anything else for that matter. The only personal information I save is in the site log which has a line for each page view which includes the IP address your browser sends in the header as well as which page you requested. I use this to block hackers and other bad actors. I do not use this raw data to create profiles on users. I periodically delete the log files. Google supplies the ads on this site. Because I do not track who you are, I cannot customize how these ads are served. They may be personalized to improve the ad experience. If you do not want personalized ads, please adjust the settings on the Google site HERE.
. NOTE: The best I can determine, this site is not subject to CCPA but I am doing my best to comply anyway. Disclaimer:
The information on this web site has not been checked for accuracy. It is for entertainment purposes only and should be independently verified before using for any other reason. There are five sources. 1) Documents and manuals from a variety of sources. These have not been checked for accuracy and in many cases have not even been read by anyone associated with I have no idea of they are useful or accurate, I leave that to the reader. 2) Articles others have written and submitted. If you have questions on these, please contact the author. 3) Articles that represent my personal opinions. These are intended to promote thought and for entertainment. These are not intended to be fact, they are my opinions. 4) Small programs that generate result presented on a web page. Like any computer program, these may and in some cases do have errors. Almost all of these also make simplifying assumptions so they are not totally accurate even if there are no errors. Please verify all results. 5) Weather information is from numerous of sources and is presented automatically. It is not checked for accuracy either by anyone at or by the source which is typically the US Government. See the NOAA web site for their disclaimer. Finally, tide and current data on this site is from 2007 and 2008 data bases, which may contain even older data. Changes in harbors due to building or dredging change tides and currents and for that reason many of the locations presented are no longer supported by newer data bases. For example, there is very little tidal current data in newer data bases so current data is likely wrong to some extent. This data is NOT FOR NAVIGATION. See the XTide disclaimer for details. In addition, tide and current are influenced by storms, river flow, and other factors beyond the ability of any predictive program.