Proper Transfer of Int to String Conversion

I’m using and RTC and I’m in the following code properly converting the integers of the RTC values into a String called Time. I want to be able to e-mail the String Time. I can properly past the serial.Print(Time); but i can’t seem to send it via string in fact i can’t send any of the string variables by e-mail. Let me know if this code looks fine. This is my function for the conversion.

void digitalClockDisplay(){
// digital clock display of the time
Hour = String(hour());
Minute = String(minute());
Second = String(second());
if (minute() < 10) Minute = “0” + Minute;
if (second() < 10) Second = “0” + Second;
Time = Hour + “:” + Minute + “:” + Second;
}

Thanks for any potential Help!

I want to be able to e-mail the String Time.

I ditch the String, and just use sprintf.

Well, if you can Serial.print() this string, then that is working OK. You will get a lot of advice to avoid using String objects for various reasons, but if that part is working for you, then there is not much point in posting that part of the code.

How exactly are you trying “to send it by email’” ?

I'm using an ethernet shield on my Arduino Uno. Sending it through Temboo using the Choreo of Gmail. My main issue that I figure is the problem for it not sending could be I'm exceeding the memory limit on the UNO. I haven't been able to find any information on how much data a String consumes so this is just a educated guess.

You can’t send a C++ object by email. Email is text. A String is an object. Check how you are putting the String object into the email, the method you are using may require a null-terminated char array, not a String object.

Avoiding memory limits is one of the many good reasons to avoid using the String class.

If memory is a problem because of other code that you have in your project, try writing a simple test program that just creates a String and tried to send an email.

I have been successful in sending strings as Static test, I'll have to read up on sending char arrays as I have never used them. I can show you how the static test commands comes out so you can see the functioning code.

String MessageBodyValue = "Here is some Information for you: This is extra data testing the length or size of my string. It seems we can go much larger! How bout this";

SendEmailChoreo.addInput("MessageBody", MessageBodyValue);

This seems to also be the max cap at the size of string i was able to send!

Thanks everyone for the help but the

AWOL: I ditch the String, and just use sprintf.

Saved the day here Thank you again!

Mission success