Home/Support/Support Forum/How do I send a variable in the body of an e-mail?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How do I send a variable in the body of an e-mail?

0 votes
Hello, I have been unsuccessful at sending a variable in the body of an e-mail. I have created an array using sprint as a buffer, but has not worked.
pos = sprintf(body, "this is a test", varaible);
emailArray[0].body = pos;

variable declared as float.

I am able to send text.

Cloud someone please offer a suggestion on how to do this?

Thank you,
Dave
asked Nov 14, 2014 in Rabbit by dcloud New to the Community (9 points)

Please log in or register to answer this question.

3 Answers

+1 vote
Good afternoon, I suggest doing a GREP search in Dynamic C for "email", there are several different sample that would help you
answered Nov 14, 2014 by MargaretK Veteran of the Digi Community (545 points)
+1 vote
There is no print specifier in your example above for variable. Try something like:

pos = sprintf(body, "this is a test %f", varaible);

Regards,
Peter
answered Nov 15, 2014 by petermcs Veteran of the Digi Community (1,130 points)
+1 vote
You should be able to do something along the lines of:

auto char buffer[128];
int data;

sprintf(buffer, "Data is %d", data);
emailArray[0].body = buffer;
answered Nov 15, 2014 by trooper2 Veteran of the Digi Community (589 points)
...