0

By default, when someone sends an email to FogBugz, FogBugz will respond with the email address of the receiving mailbox, e.g.:

  • Email was sent to cases@yoursite.fogbugz.com
  • From address in reply will default to cases@yoursite.fogbugz.com

Sometimes you want to always have a particular user reply via a certain email address. For example, you might want your sales team to always reply from sales@yourcompany.com, regardless of where the email was sent, e.g.:

  • Email was sent to cases@yoursite.fogbugz.com
  • A sales user is logged in
  • The From address in the reply should be sales@yourcompany.com

Is this possible in FogBugz?

flag

1 Answer

2

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.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.