you can use sprintf
i.e. in your config file you will have
welcomemail = "bla bla bla %1$s blablabla %2$s ...."
and then in php
$messagecontent = sprintf ($smarty->getConfigVariable('welcomemail'),$username,$itemname);
However, I think that the easiest and most flexible way to create mails is to write a template for the body of the mail, process it with smarty and get the output in a variable instead of displaying it on the screen