Open qa-include/app/mailing.php and replace the qa_mailing_send_one function with this one:
function qa_mailing_send_one($userid, $handle, $email, $emailcode)
{
require_once QA_INCLUDE_DIR.'app/emails.php';
require_once QA_INCLUDE_DIR.'db/users.php';
if (!strlen(trim($emailcode))) {
$emailcode=qa_db_user_rand_emailcode();
qa_db_user_set($userid, 'emailcode', $emailcode);
}
$unsubscribeurl=qa_path_absolute('unsubscribe', array('c' => $emailcode, 'u' => $handle));
$userprofile = qa_db_single_select(qa_db_user_profile_selectspec($userid, true));
$userName = isset($userprofile['name']) && !empty($userprofile['name']) ? $userprofile['name'] : $handle;
$subs = array(
'^name' => $userName,
'^handle' => $handle,
);
$emailBody = strtr(trim(qa_opt('mailing_body')), $subs);
return qa_send_email(array(
'fromemail' => qa_opt('mailing_from_email'),
'fromname' => qa_opt('mailing_from_name'),
'toemail' => $email,
'toname' => $handle,
'subject' => qa_opt('mailing_subject'),
'body' => $emailBody."\n\n\n".qa_lang('users/unsubscribe').' '.$unsubscribeurl,
'html' => false,
));
}
Then just use ^handle and ^name in your mass emails and they'll be replaced with the appropriate values. Note that ^name is the default name field that comes configured with Q2A and if it is deleted and recreated, it might have a different way of identifying it. Also note that as user fields are optional, which means users might not have configured a name such as Gabriel. In these cases the handle, such as pupi1985, will be used.