This can achieved using a BugMonkey script. You'll need to map the exact user names to the exact email box. Once set up, FogBugz will rewrite the 'From' field to the specified email address whenever someone replies to an email within FogBugz.
name: User Account Email Mapping
description: Allows you to map user names to email addresses so that the user always
sends mail from a specific email address.
author: Ben McCormack
version: 1.0.0.0
js:
var sUsers = {};
//define your user and mailbox associations here. The user name must match
//the full name of the user in FogBugz. The mailbox must match an available
//option in the From field when sending an email.
sUsers['Ben McCormack'] = '"Test Mailbox" <testmailbox@mistyriversoftware.com>';
sUsers['Barney Rubble'] = '"FogBugz On Demand" <cases@benmtest.fogbugz.com>';
//main is called at the bottom
function main() {
if (!replyingToEmail()){
return;
}
var sEmailToUse = getEmailAddressOfCurrentUser();
if (sEmailToUse !== false && sEmailToUse !== ''){
changeEmailAddress(sEmailToUse);
}
}
//this function tells us if we're currently replying to an email
function replyingToEmail(){
return $('div.body.editable .emailHeader').length !== 0;
}
function getEmailAddressOfCurrentUser(){
var sCurrentUser = GetFullName();
if (sUsers[sCurrentUser]===undefined){
//this user didn't have a mailbox defined, so return false
return false;
}
return sUsers[sCurrentUser];
}
function changeEmailAddress(sEmail){
var droplist = $('select#sFrom');
droplist.val(sEmail);
DropListControl.refresh(droplist[0]);
}
main();
$(window).on('BugViewChange', main);
NOTE: It might be possible to automatically try to associate the email of the address of the user with an existing mailbox if that mailbox exists, but that's not currently how it's set up. If that's something you'd like to see, send us an email and reference this script.