Using EMail Sender library with Arduino UNO Ethernet shield with Ethernet.h library

Home Forums The libraries hosted on the site EMailSender send email with attachments Using EMail Sender library with Arduino UNO Ethernet shield with Ethernet.h library

Viewing 32 reply threads
  • Author
    Posts
    • #9468
      tpapas
      Participant

        Hello and thank you for reading this…

        Total newbie in Arduino and in this amazing looking library (thanks Renzo)!

        I’m creating a simple project of a weather station for my radio station.

        I’m finding bits and pieces from various projects and sketches and putting it all together, it seems that I’ve almost reached my goal and I’m pretty happy since I’ve never worked with an Arduino before.
        I have an Arduino Uno with an Ethernet shield. In my weather station project, which is running a simple webserver, I have 2 temperatures, one for Outside and one for Inside. The inside temperature is inside the room where all the transmitter equipment is running and its air conditioned of course. What I need to do is send an email to myself if the Inside temperature exceeds 30C degrees. That’s all.
        Tried to compile and run the code in the beginning of Renzo’s page (the one in the Arduino section “Send Simple email”) but it gets stuck in the #include <UIPEthernet.h> which I probably don’t have. I’m currently using Ethernet.h in my webserver.
        Any help in making this happen, will be greatly appreciated!

        Thank you

      • #9470
        Renzo Mischianti
        Keymaster

          Hi tpapas,

          the problem is that you must change some parameter because the library, by default, use UIPEthernet library for ENC28J60 low cost device.

          You must open the file EMailSenderKey.h in your library folder and change

           

          #ifndef DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO
               #define DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO NETWORK_ENC28J60
          #endif

          in

          #ifndef DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO
               #define DEFAULT_EMAIL_NETWORK_TYPE_ARDUINO NETWORK_W5100
          #endif

          with this operation Ethernet.h library, that you use, is activated, and I think all work correctly.

          You can find the file in

          <Sketchbook location>\Arduino\libraries\EMailSender

          and you can find Sketchbook location in File –> Preferences of the Arduino IDE

          You can find more information about that here

          Send email with attachments (v2.x library): Arduino Ethernet – 1

           

          If you have problems write without problem.

          Bye Renzo

        • #9471
          tpapas
          Participant

            Thank you Renzo for the immediate reply.

            I did the modification and it did compile.

            I do get :

            “Sketch uses 27308 bytes (84%) of program storage space. Maximum is 32256 bytes.
            Global variables use 2004 bytes (97%) of dynamic memory, leaving 44 bytes for local variables. Maximum is 2048 bytes.
            Low memory available, stability problems may occur. ”

            from the compiler!

            I run it but it does absolutely nothing… What am I missing?!

            Here’s the code :

            #include “Arduino.h”
            #include <SPI.h>
            #include <Ethernet.h>
            #include <EMailSender.h>

            // Enter a MAC address for your controller below.
            // Newer Ethernet shields have a MAC address printed on a sticker on the shield
            byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

            EMailSender emailSend(“my sendgrid API key”, “my sendgrid login pwd”, “my sendgrid login verified email”, “smtp.sendgrid.net”, 25);

            void setup()
            {
            // Open serial communications and wait for port to open:
            Serial.begin(115200);
            while (!Serial) {}

            delay(2000);

            Serial.println(“Starting!”);

            // start the Ethernet connection:
            if (Ethernet.begin(mac) == 0) {
            Serial.println(“Failed to configure Ethernet using DHCP”);
            while(1);
            }
            Serial.print(“IP address “);
            Serial.println(Ethernet.localIP());

            EMailSender::EMailMessage message;
            message.subject = “High Temperature in TX Site”;
            message.message = “Please check the A/C unit<br>High temperature!<br>Thank you”;

            EMailSender::Response resp = emailSend.send(“my sendgrid login verified email”, message);

            Serial.println(“Sending status: “);

            Serial.println(resp.status);
            Serial.println(resp.code);
            Serial.println(resp.desc);
            }

            void loop()
            {

            }

            • #9480
              Renzo Mischianti
              Keymaster

                Hi tpapas,

                I release now a new library version, now you must change the previous operation to activate W5100 like device and comment the line

                // #define ENABLE_ATTACHMENTS

                so a lot of memory (no SD import and similar) become free and you can send email without problem.

                Give me a feedback Renzo

                 

            • #9472
              Renzo Mischianti
              Keymaster

                I think the Arduino UNO have few memory.

                The sructure used is too big.

                Tomorrow I check if disable sd fix the problem.

                Bye Renzo

              • #9481
                tpapas
                Participant

                  Renzo, thank you for the effort, yes now it compiled no problem

                  Sketch uses 20064 bytes (62%) of program storage space. Maximum is 32256 bytes.
                  Global variables use 1375 bytes (67%) of dynamic memory, leaving 673 bytes for local variables. Maximum is 2048 bytes.

                  But the code I sent you above, doesn’t seem to do anything! Is it missing something!? Do I need to do something? It doesn’t prompt me for anything and of course it doesn’t send the email.

                • #9482
                  Renzo Mischianti
                  Keymaster

                    Hi tpapas,

                    It’s strange, I test the code (without shield) but I can read the Serial output on monitor.

                    Try to uncomment the EMailSender debug also.

                    #define EMAIL_SENDER_DEBUG

                    I have 1.8.13 version of Arduino IDE and code execute (with error because I don’t install the shield).

                    Bye Renzo

                  • #9483
                    tpapas
                    Participant

                      Sorry Renzo … my bad! See I told you I’m a total newbie… The problem was that my serial monitor was set at 9600 baud so it couldn’t read… I set it now at 115200 and it did write :

                      Starting!
                      IP address 192.168.1.235
                      ONLY ONE RECIPIENTmiltiple destination and attachments
                      Insecure client:0
                      220 SG ESMTP service ready at ismtp
                      Sending status:
                      0

                      )

                      Still no email sent though! So what do you see?

                    • #9484
                      tpapas
                      Participant

                        Also keep in mind that I don’t use any encoding in my email address or password or api key! They ‘re copied and pasted from the sendgrid site!

                      • #9491
                        Renzo Mischianti
                        Keymaster

                          Hi tpapas,

                          I think that is a memory problem again, try to put inside F(“string”) the serial string to free some memory, but Arduino UNO with 2k of ram It’s quite tedious.

                          I don’t have a w5100 shield only enc26j80 that It’s quite unusable with Arduino UNO.

                          Bye Renzo

                        • #9492
                          tpapas
                          Participant

                            -try to put inside F(“string”) the serial string

                            I don’t understand Renzo?!

                          • #9493
                            Renzo Mischianti
                            Keymaster

                              If you rewrite

                              Serial.print(“IP address “);

                              in

                              Serial.print(F(“IP address “));

                              You free 11*1byte

                               

                               

                            • #9494
                              tpapas
                              Participant

                                It doesn’t compile, I get an error : exit status 1
                                stray ‘\342’ in program

                                • #9496
                                  Renzo Mischianti
                                  Keymaster

                                    If you copy and paste my code you must substitute the double quote because the editor change these in another character.

                                    But do the change manually to all serial, you musto incapsulate string inside F().

                                     

                                    The structure of static IP use some memory also.

                                     

                                • #9495
                                  tpapas
                                  Participant

                                    I use static IP for the project anyway, maybe we can avoid all that by doing it in static…

                                    Would that (maybe) give me more memory?

                                  • #9497
                                    tpapas
                                    Participant

                                      -The structure of static IP use some memory also.

                                      Yes it was just a suggestion since I ‘m using static anyway.

                                      Ok, it did compile, and it gives the same exact result Renzo…

                                      Starting!
                                      IP address 192.168.1.235
                                      Sending status:
                                      0

                                      )

                                      Could it be that (maybe) I have something wrong in the credentials? Is there any way to debug this?

                                      • #9498
                                        Renzo Mischianti
                                        Keymaster

                                          Yes,

                                          Try to uncomment the EMailSender debug also.

                                          #define EMAIL_SENDER_DEBUG

                                          With this define uncommented you must receive all the client request response.

                                      • #9499
                                        tpapas
                                        Participant

                                          Starting!
                                          IP address 192.168.1.235
                                          ONLY ONE RECIPIENTmiltiple destination and attachments
                                          Insecure client:0
                                          220 SG ESMTP service ready at ismtpd0005p1
                                          Sending status:
                                          0

                                          )

                                        • #9500
                                          Renzo Mischianti
                                          Keymaster

                                            Hi tpapas,

                                            It’s the memory usage, i need to recreate the context and try to do some trick to work with this few memory.

                                            I think for now the better solution is to get an Arduino Mega and retry, UNO had very low stats.

                                            But i try to keep in work your configuration when find some time.

                                            Bye Renzo

                                          • #9513
                                            tpapas
                                            Participant

                                              Renzo, thank you for the help and the replies of course, I ‘m the least expert in this of course, but it doesn’t seem to me that its a memory problem. It does compile and running fine always producing the same results…
                                              But… to satisfy mine and your curiosity, I will go out and get an Arduino Mega and try it there too. No harm done in that 🙂

                                            • #9515
                                              tpapas
                                              Participant

                                                Well, I guess you were right Renzo!
                                                I got a Mega 2560 and re-compiled… This is what I get now:

                                                Starting!
                                                IP address 192.168.1.235
                                                ONLY ONE RECIPIENTmiltiple destination and attachments
                                                Insecure client:0
                                                220 SG ESMTP service ready at ismtpd0005p1lon1.sendgrid.net
                                                HELO mischianti:
                                                250 Hello, nice to meet you
                                                AUTH LOGIN:
                                                334 VXNlcm5hbWU6
                                                Encoding
                                                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
                                                69
                                                U0cuQjVuREU3VHhSRnVRN2VRZDZMRXdtZy5NenBfdzgyWVF2blRDMnI1ZVMzbGd5b0xQNTd6VlZnMzhfMENvdkxxWWZR
                                                Encoding
                                                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
                                                69
                                                334 UGFzc3dvcmQ6
                                                Encoding
                                                9VPtvGtxr,H2q!j-
                                                16
                                                OVZQdHZHdHhyLEgycSFqLQ==
                                                Encoding
                                                9VPtvGtxr,H2q!j-
                                                16
                                                535 Authentication failed: Bad username / password
                                                Sending status:
                                                0
                                                235
                                                SMTP AUTH error (535 Authentication failed: Bad username / password )

                                                But my credentials are correct, since I got them directly from the sendgrid site. What am I doing wrong can you help me please?!

                                              • #9516
                                                Renzo Mischianti
                                                Keymaster

                                                  Hi tpapas,

                                                  Next I try to free some memory from my library or do something alternative for Arduino UNO.

                                                  Now to use SMTP you must follow this step

                                                  https://sendgrid.com/docs/for-developers/sending-email/getting-started-smtp/

                                                  and

                                                  https://sendgrid.com/docs/for-developers/sending-email/integrating-with-the-smtp-api/

                                                  First you must validate the sender email than create api key to use as login and passwd.

                                                  If you have problem, write here.

                                                  Bye Renzo

                                                • #9517
                                                  tpapas
                                                  Participant

                                                    Renzo, I ‘ve asked you this before but you didn’t tell me… Do I need to convert my credentials to Base64 or your library does it automatically?

                                                    • #9518
                                                      Renzo Mischianti
                                                      Keymaster

                                                        Yes, all credential is encoded in base64.

                                                        Bye Renzo

                                                    • #9519
                                                      tpapas
                                                      Participant

                                                        Man, this is really a brain buster and frustrating!

                                                        I believe I’ve done everything created a sender, an API etc, trying the TELNET example and on the end it tells me :

                                                        550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements

                                                        And I have verified a sender identity… Why does it have to be so difficult?!

                                                        I don’t know what else to do!

                                                      • #9520
                                                        Renzo Mischianti
                                                        Keymaster

                                                          you must set the from (in the declaration of EMailSender) the verified email, I think It’s sufficient, I don’t remember other operation.

                                                          Bye Renzo

                                                        • #9521
                                                          tpapas
                                                          Participant

                                                            Renzo, this is the line in your code that sends the email:

                                                            EMailSender emailSend(“<YOUR-SENDGRID-API-KEY>”, “<YOUR-SENDGRID-PASSWD>”, “<FROM-EMAIL>”, “smtp.sendgrid.net”, 25);

                                                            In the first attachment Sendgrid asks which method, WEB Api or SMTP Relay, I choose SMTP relay.

                                                            In there you can create a NEW Api key, I already have another API key created elsewhere in Sendgrid, so I’m not sure which key to use!

                                                            Then (in your code), you’re saying <YOUR-SENDGRID-PASSWD>, which password is that? The one that I use to login to the Sendgrid site?

                                                            If you can please help me finish this, it’s so confusing! Can I give you a Teamviewer or Anydesk if you want and we can fix it together?

                                                             

                                                            • #9523
                                                              Renzo Mischianti
                                                              Keymaster

                                                                Hi tpasas,

                                                                you are right, i put not clear label,

                                                                <YOUR-SENDGRID-API-KEY> is the user or apikey name, by default, if i remember, is ‘apikey’,

                                                                 

                                                                YOUR-SENDGRID-PASSWD> is the key generated the long string.

                                                                 

                                                                <FROM-EMAIL> is the verified email address sender.

                                                                 

                                                                I think now is more comprehensive.

                                                                 

                                                                When i have time i write a little guide.

                                                                Bye Renzo

                                                            • #9524
                                                              tpapas
                                                              Participant

                                                                Finally IT WORKED!!!!

                                                                235 Authentication successful
                                                                MAIL FROM: <tpapas@datamax.gr>
                                                                250 Sender address accepted
                                                                RCPT TO: <tpapas@datamax.gr>
                                                                250 Recipient address accepted
                                                                DATA:
                                                                354 Continue
                                                                Message end
                                                                250 Ok: queued as oPx9XH7JQ8uREgp8eyHDbg
                                                                221 See you later
                                                                Sending status:
                                                                1
                                                                0
                                                                Message sent!

                                                                • #23498
                                                                  Mohamed
                                                                  Participant

                                                                    You have my best regards
                                                                    Own a data transmission project using Arduino
                                                                    Please send me a copy of the successful coding

                                                                • #9525
                                                                  tpapas
                                                                  Participant

                                                                    How can I have multiple recipients now?

                                                                  • #9528
                                                                    tpapas
                                                                    Participant

                                                                      Renzo, that I could follow and do easily, and yes it worked, I managed to do 3 recipients!

                                                                      Now, another weird and upsetting problem occurred though.
                                                                      I stopped using the UNO and installed the MEGA (which is actually a clone – not original), the email app worked beautifully now with the extra recipients and all… BUT, the webserver app with the weather station, which (like I told you) is my main app isn’t working anymore!

                                                                      So I’m drawing a blank, now, I don’t know what to do and why isn’t this thing working?!
                                                                      I’m asking you maybe you have an idea, because you’re a working with all this Arduino stuff!

                                                                      Could it be the clone board? Could it be some 47Ohm resistors that somebody told me that I should solder under the Ethernet shield’s ethernet plug?
                                                                      No idea…

                                                                    • #9533
                                                                      Renzo Mischianti
                                                                      Keymaster

                                                                        If the email work the ethernet work, the arduino clones, usually, work like a charm,

                                                                        With this information It’s very difficult to do a debug.

                                                                        You must give me more information, what kind of problem do you have?

                                                                        Bye Renzo

                                                                         

                                                                      • #9534
                                                                        tpapas
                                                                        Participant

                                                                          Renzo, good morning and a good week to you my friend.
                                                                          You ‘re asking me what kind of problem do I have, it doesn’t work anymore!
                                                                          On the UNO the code I will share with you works fine, it’s a webserver Weather Station that produces an HTML page with all the different measures, on a static IP.

                                                                          Now on the Mega, no page loads, no output whatsoever, nothing!

                                                                          Try it yourself (if you can/want/have the time) and let me know.

                                                                          Here’s the code:

                                                                          
                                                                          #include <SPI.h>
                                                                          #include <Ethernet.h>
                                                                          #include <OneWire.h>
                                                                          #include <DallasTemperature.h>
                                                                          #include "TimerOne.h"
                                                                          #include <math.h>
                                                                          #include "cactus_io_BME280_I2C.h"
                                                                          
                                                                          #define TX_Pin 8 // used to indicate web data tx
                                                                          // Data wire is plugged into digital pin 9 on the Arduino
                                                                          #define ONE_WIRE_BUS 9
                                                                          #define WindSensor_Pin (2) // digital pin for wind speed sensor
                                                                          #define WindVane_Pin (A2) // analog pin for wind direction sensor
                                                                          #define VaneOffset 0 // define the offset for caclulating wind direction
                                                                          
                                                                          volatile unsigned int timerCount; // used to count ticks for 2.5sec timer count
                                                                          volatile unsigned long rotations; // cup rotation counter for wind speed calcs
                                                                          volatile unsigned long contactBounceTime; // timer to avoid contact bounce in wind speed sensor
                                                                          
                                                                          volatile float windSpeed;
                                                                          int vaneValue; // raw analog value from wind vane
                                                                          int vaneDirection; // translated 0 - 360 wind direction
                                                                          int calDirection; // calibrated direction after offset applied
                                                                          int lastDirValue; // last recorded direction value
                                                                          
                                                                          int deviceCount = 0; // how many DS18B20 we keep on the OneWire
                                                                          
                                                                          float OutminTemp; // keep track of minimum recorded Outside temp
                                                                          float OutmaxTemp; // keep track of maximum recorded Outside temp
                                                                          float InminTemp; // keep track of minimum recorded Inside temp
                                                                          float InmaxTemp; // keep track of maximum recorded Inside temp
                                                                          
                                                                          // Setup a oneWire instance to communicate with any OneWire device
                                                                          OneWire oneWire(ONE_WIRE_BUS);
                                                                          
                                                                          // Pass oneWire reference to DallasTemperature library
                                                                          DallasTemperature sensors(&oneWire);
                                                                          
                                                                          BME280_I2C bme; // I2C using address 0x77
                                                                          
                                                                          // Here we setup the web server. We are using a static ip address and a mac address
                                                                          byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
                                                                          IPAddress ip(192, 168, 1, 45);
                                                                          EthernetServer server(8081); // create a server listing on 192.168.1.45 port 80
                                                                          
                                                                          void setup() {
                                                                          
                                                                          // setup anemometer values
                                                                          	lastDirValue = 0;
                                                                          	rotations = 0;
                                                                          
                                                                          // setup timer values
                                                                          	timerCount = 0;
                                                                          
                                                                          	{
                                                                          		sensors.begin(); // Start up the library
                                                                          		Serial.begin(9600);
                                                                          // locate devices on the bus
                                                                          // Serial.print("Locating devices...");
                                                                          // Serial.print("Found ");
                                                                          // deviceCount = sensors.getDeviceCount();
                                                                          // Serial.print(deviceCount, DEC);
                                                                          // Serial.println(" devices.");
                                                                          // Serial.println("");
                                                                          		sensors.requestTemperatures();
                                                                          		InminTemp = sensors.getTempCByIndex(0);
                                                                          		InmaxTemp = sensors.getTempCByIndex(0);
                                                                          		OutminTemp = sensors.getTempCByIndex(1);
                                                                          		OutmaxTemp = sensors.getTempCByIndex(1);
                                                                          	}
                                                                          
                                                                          // disable the SD card by switching pin 4 High
                                                                          	pinMode(4, OUTPUT);
                                                                          	digitalWrite(4, HIGH);
                                                                          
                                                                          // start the Ethernet connection and server
                                                                          	Ethernet.begin(mac, ip);
                                                                          	server.begin();
                                                                          
                                                                          	if (!bme.begin()) {
                                                                          // Serial.println("Could not find BME280 sensor, check wiring!");
                                                                          		while (1)
                                                                          			;
                                                                          	}
                                                                          
                                                                          	pinMode(TX_Pin, OUTPUT);
                                                                          //pinMode(RG11_Pin, INPUT);
                                                                          	pinMode(WindSensor_Pin, INPUT);
                                                                          	attachInterrupt(digitalPinToInterrupt(WindSensor_Pin), isr_rotation,
                                                                          			FALLING);
                                                                          
                                                                          // setup the timer for 0.5 second
                                                                          	Timer1.initialize(500000);
                                                                          	Timer1.attachInterrupt(isr_timer);
                                                                          
                                                                          	sei(); // Enable Interrupts
                                                                          }
                                                                          
                                                                          void loop() {
                                                                          
                                                                          // Send command to all the sensors for temperature conversion
                                                                          	sensors.requestTemperatures();
                                                                          
                                                                          	bme.readSensor();
                                                                          
                                                                          // update min and max temp values for Outside and Inside Temperatures
                                                                          	if (sensors.getTempCByIndex(1) < OutminTemp) {
                                                                          		OutminTemp = sensors.getTempCByIndex(1);
                                                                          	}
                                                                          	if (sensors.getTempCByIndex(1) > OutmaxTemp) {
                                                                          		OutmaxTemp = sensors.getTempCByIndex(1);
                                                                          	}
                                                                          
                                                                          	if (sensors.getTempCByIndex(0) < InminTemp) {
                                                                          		InminTemp = sensors.getTempCByIndex(0);
                                                                          	}
                                                                          	if (sensors.getTempCByIndex(0) > InmaxTemp) {
                                                                          		InmaxTemp = sensors.getTempCByIndex(0);
                                                                          	}
                                                                          
                                                                          // listen for incoming clients
                                                                          	EthernetClient client = server.available();
                                                                          	if (client) {
                                                                          // an http request ends with a blank line
                                                                          		boolean currentLineIsBlank = true;
                                                                          		while (client.connected()) {
                                                                          			if (client.available()) {
                                                                          				char c = client.read();
                                                                          				Serial.write(c);
                                                                          // if you've gotten to the end of the line (received a newline
                                                                          // character) and the line is blank, the http request has ended,
                                                                          // so you can send a reply
                                                                          				if (c == '\n' && currentLineIsBlank) {
                                                                          // send a standard http response header
                                                                          					digitalWrite(TX_Pin, HIGH);
                                                                          					client.println("HTTP/1.1 200 OK");
                                                                          					client.println("Content-Type: text/html");
                                                                          					client.println("Connection: close"); // connection closed completion of response
                                                                          					client.println("Refresh: 10"); // refresh the page automatically every 10 sec
                                                                          					client.println();
                                                                          					client.println("<!DOCTYPE HTML>");
                                                                          					client.print(
                                                                          							"<HTML><HEAD><TITLE>RadioActive Weather Server</TITLE></HEAD>");
                                                                          					client.println(
                                                                          							"<font color='red'><h2>RadioActive Weather Server</font></h2>");
                                                                          					client.print(
                                                                          							"Agios Merkouris, Sifnos @ 36.987832, 24.719809<br><br>");
                                                                          					client.println("<html><body>");
                                                                          					digitalWrite(TX_Pin, HIGH); // Turn the TX LED on
                                                                          					client.print(
                                                                          							"<span style=\"font-size: 26px\";>Outside Temperature now ");
                                                                          					client.print(sensors.getTempCByIndex(1));
                                                                          					client.println("C<br>");
                                                                          					client.print("<br> Inside Temperature now ");
                                                                          					client.print(sensors.getTempCByIndex(0));
                                                                          					client.println("C<br>");
                                                                          
                                                                          					client.print("<br> Wind Speed now ");
                                                                          					client.print(windSpeed);
                                                                          					client.println(" mph<br>");
                                                                          					getWindDirection();
                                                                          					client.print("<br> Direction now ");
                                                                          					client.print(calDirection);
                                                                          					if ((calDirection) < 23) {
                                                                          						client.print(" North");
                                                                          					}
                                                                          					if ((calDirection > 22) && (calDirection < 68)) {
                                                                          						client.print(" NorthEast");
                                                                          					}
                                                                          					if ((calDirection > 67) && (calDirection < 113)) {
                                                                          						client.print(" East");
                                                                          					}
                                                                          					if ((calDirection > 112) && (calDirection < 158)) {
                                                                          						client.print(" SouthEast");
                                                                          					}
                                                                          					if ((calDirection > 157) && (calDirection < 203)) {
                                                                          						client.print(" South");
                                                                          					}
                                                                          					if ((calDirection > 202) && (calDirection < 247)) {
                                                                          						client.print(" SouthWest");
                                                                          					}
                                                                          					if ((calDirection > 246) && (calDirection < 292)) {
                                                                          						client.print(" West");
                                                                          					}
                                                                          					if ((calDirection > 291) && (calDirection < 337)) {
                                                                          						client.print(" NorthWest");
                                                                          					}
                                                                          					if ((calDirection > 336) && (calDirection <= 360)) {
                                                                          						client.print(" North");
                                                                          					}
                                                                          					client.println("<br>");
                                                                          					client.print("<br> Humidity now ");
                                                                          					client.print(bme.getHumidity());
                                                                          					client.println("%<br>");
                                                                          					client.print("<br> Pressure now ");
                                                                          					client.print(bme.getPressure_MB());
                                                                          					client.println("mb%<br>");
                                                                          					client.print("<br> Outside Min Temperature was ");
                                                                          					client.print(OutminTemp);
                                                                          					client.println("C<br>");
                                                                          					client.print("<br> Outside Max Temperature was ");
                                                                          					client.print(OutmaxTemp);
                                                                          					client.println("C<br>");
                                                                          					client.print("<br> Inside Min Temperature was ");
                                                                          					client.print(InminTemp);
                                                                          					client.println("C<br>");
                                                                          					client.print("<br> Inside Max Temperature was ");
                                                                          					client.print(InmaxTemp);
                                                                          					client.println("C");
                                                                          					client.println("</body></html>");
                                                                          					digitalWrite(TX_Pin, LOW); // Turn the TX LED off
                                                                          					break;
                                                                          				}
                                                                          				if (c == '\n') {
                                                                          // you're starting a new line
                                                                          					currentLineIsBlank = true;
                                                                          				} else if (c != '\r') {
                                                                          // you've gotten a character on the current line
                                                                          					currentLineIsBlank = false;
                                                                          				}
                                                                          			}
                                                                          		}
                                                                          	}
                                                                          
                                                                          // give the web browser time to receive the data
                                                                          	delay(1);
                                                                          // close the connection:
                                                                          	client.stop();
                                                                          }
                                                                          
                                                                          // Interrupt handler routine for timer interrupt
                                                                          void isr_timer() {
                                                                          
                                                                          	timerCount++;
                                                                          
                                                                          	if (timerCount == 5) {
                                                                          // convert to mp/h using the formula V=P(2.25/T)
                                                                          // V = P(2.25/2.5) = P * 0.9
                                                                          		windSpeed = rotations * 0.9;
                                                                          		rotations = 0;
                                                                          		timerCount = 0;
                                                                          	}
                                                                          }
                                                                          
                                                                          // Interrupt handler routine to increment the rotation count for wind speed
                                                                          void isr_rotation() {
                                                                          
                                                                          	if ((millis() - contactBounceTime) > 15) { // debounce the switch contact
                                                                          		rotations++;
                                                                          		contactBounceTime = millis();
                                                                          	}
                                                                          }
                                                                          
                                                                          // Get Wind Direction
                                                                          void getWindDirection() {
                                                                          
                                                                          	vaneValue = analogRead(WindVane_Pin);
                                                                          	vaneDirection = map(vaneValue, 0, 1023, 0, 360);
                                                                          	calDirection = vaneDirection + VaneOffset;
                                                                          
                                                                          	if (calDirection > 360)
                                                                          		calDirection = calDirection - 360;
                                                                          
                                                                          	if (calDirection > 360)
                                                                          		calDirection = calDirection - 360;
                                                                          }
                                                                          
                                                                        • #10381
                                                                          Gilles

                                                                            I just did a telnet test for sendgrid.

                                                                            It is impossible for me to connect to open smtp.sendgrid.net 25.
                                                                            On the other hand I manage to send an email from telnet but with open smtp.sendgrid.net 587.
                                                                            But suddenly it is in secure mode and the Arduino with the shield w5100 it does not work (well there I can at least connect to the server I just get the error: 14: 17: 28.511 -> resp Code: 235 14: 17: 28.511 -> Description: SMTP AUTH error (535 Authentication failed: The provided authorization grant is invalid, expired, or revoked ))
                                                                            Whereas with port 25 it is impossible for me to connect to the server either by telnet or via the arduino …
                                                                            I do not understand anything! Thank you
                                                                            • #10382
                                                                              Renzo Mischianti
                                                                              Keymaster

                                                                                Try to do

                                                                                ping smtp.sendgrid.net

                                                                                 

                                                                                Esecuzione di Ping smtp.sendgrid.net [18.197.194.208] con 32 byte di dati:

                                                                                 

                                                                                and check if you can read the IP.

                                                                                Bye Renzo

                                                                            • #10388
                                                                              Gilles

                                                                                ping smtp.sendgrid.net

                                                                                from  telnet?

                                                                                I did tests from Telnet under windows seven.
                                                                                Do you have to open the connection with the sendGrid server first?
                                                                                I tried open smtp.sendgrid.net 587
                                                                                then ping smtp.sendgrid.net I get 500 command not implented
                                                                                and if I don’t open first … 587
                                                                                I get an invalid order

                                                                                Have you tried from your orange email address to open a sendgrid account to see if you can connect to the smtp server port 25?
                                                                                Thank you

                                                                              • #10389
                                                                                Gilles

                                                                                  I have just done from the msdos prompt a test with ping smtp.orange.fe it works well: ping for 193.252.22.64:
                                                                                  packets sent 4, received 4 ….

                                                                                  But when I do ping.smtp.sendgrid.net I get:
                                                                                  The ping request did not find the smtp.sendgrid.net host. Check the name and try again

                                                                                • #10432
                                                                                  Gilles

                                                                                    I just re pinged (more than 3 times) smtp.sengrid.net:
                                                                                    sending a ‘ping’ request to smtp.sendgrid.net [52.57.139.126] server with 32 bytes
                                                                                    request deadline exceeded.
                                                                                    request deadline exceeded.
                                                                                    request deadline exceeded.
                                                                                    request deadline exceeded.
                                                                                    Ping statistics for 52.57.139.126:
                                                                                    packets: sent 4, received 0, lost = 4 (100%)

                                                                                  • #10433
                                                                                    Renzo Mischianti
                                                                                    Keymaster

                                                                                      Hi Gilles,

                                                                                      you can try 252525, or 587 port for unencrypted connection, if you can’t use this ports mean that in your network these ports are blocked and you can’t use that.

                                                                                      Bye Renzo

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