I have the following method that sends email
char location[] = "London";
void postMail(const __FlashStringHelper *msg)
{
gsm.print(F("AT+SMTPSUB=\""));
gsm.print(title);
gsm.print("\"\r");
_buffer = _readSerial(TIMEOUT);
if (_buffer.indexOf(F("OK")) != -1)
{
uint16_t msgLength = strlen_P(reinterpret_cast<PGM_P>(msg));
gsm.print(F("AT+SMTPBODY="));
gsm.print(msgLength);
gsm.print("\r");
delay(50);
gsm.print(msg);
gsm.print(F("\""));
delay(100);
gsm.print("AT+SMTPSEND\r");
delay(50); //
_buffer = _readSerial(12000);
}
}
I want to use the variable “location” when calling the function postMail(). I mean something like
postMail(location + F(" is beautiful"));
postMail(location + F(" is safe to visit"));
postMail(location + F(" should be your next destination"));
I want to be able to pass the variable location on each function call. This will make my life really easy. What is the most efficient way to do this without overburdening my RAM.