v8 Set From Address in compose-email to Cases queue

We send outgoing email from cases to be from the Inbound Queue's email address, this was done with a customization of the "sender" field.

In v8.0.0 with Sidecar Emails this no longer appears to be possible, in part because the inbound queue email address is not even an option anymore. 

This is a serious Upgrade Show Stopper for us and I am clearly missing something about the logic behind the from field.

We have some custom compose buttons on the Emails panel top on Cases and on the Emails rowactions which set the to, from, subject and body depending on the button:

Top subpanel button Compose Internal leaves the to blank but adds case details to the body.

The Reply, Reply All, Forward buttons on the rowactiions do exactly that. It does little more than save a click on the Email name given the new Sidecar views.

For all these it is important that the From address match the Case Queue, and even if using the standard compose to reply to a Case, it is very important that the From address be the Queue.

I looked into customizations to set the From address from code.

I can do it for to_collection, cc_collection, bcc_collection but not for the from_collection.



the comments on the function



         * @param {Array|Data.BeanCollection|Data.Bean} [data.from_collection]
         * The sender to add to the From field.
         * @param {Array|Data.BeanCollection|Data.Bean} [data.from] A more
         * convenient alternative name for the sender.

but setting the from_collection (or from) in the data parameter passed to the function has no apparent effect (while it works for the to, cc, bcc).


Oddly in 



function addEmailOptions

does not mention the from_collection (or from) at all , but rather the outbound_email_id

However, inbound queues are not outbound emails.


Even if I add the data to the outbound_email table


INSERT INTO `outbound_email` (`id`,`name`,`type`,`user_id`,`mail_sendtype`,`mail_smtptype`,`mail_smtpserver`,`mail_smtpport`,`mail_smtpuser`,`mail_smtppass`,`mail_smtpauth_req`,`mail_smtpssl`,`email_address_id`,`deleted`) 
VALUES (UUID(),'Info Dev','system','1','SMTP','other','localhost',25,NULL,NULL,0,0,'3334944c-51e1-11e7-968b-001a4a160200',0);



which successfully displays the address in the From enum, when I try to send it comes back with an:

Error Page does not exist or you do not have permission to access this page.

And does NOT send the email.

The Console shows:

Failed to load resource: the server responded with a status of 403 (Forbidden)


And there are no PHP errors.

I looked at the from field in 


and it suggests that the from is not a collection but rather an enum - or is it an enum populated by a collection?


To top it all I can't even get the drawer to open with the To, Cc and From fields in edit mode... 


So, in summary, I'm lost as a lizard and could use some expert insight.

Thank you,


  • Minor progress but very clunky and I'm not too satisfied

    If I add the inbound queue as an outbound_email in the database (hack) and pass the outbound_email_id to the addEmailOptions then the from address is set correctly to the address I want and goes out with the From as the address I want.

    The problem is that the name is not what I want, it is the User Name of the outbound_email.id which I had set as 1, that is SugarAdministrator.

    I certainly don't want to send our customers email as SugarAdministrator. I suppose I could change the sugar admin's user Name to my company name but that's just another "hack".

    I really don't like where this is going...

    Any better suggestions?


  • Greg Levine, sorry to bother you, but would you be able to point me in the right direction with this one?

    Please note that I have multiple queues and for each one we should respond "From" the queue address, regardless of the teams/roles of the user who is responding.

    I have no problems retrieving the From address, the queue name or the outbound_email.id should I need to include all queues as outbound_email entries.

    This is a show-stopper for our v8.0.0 go live which currently has a deadline of May 24th and I don't think I can do this without expert help.

    thank you,


    Sugar PRD v8.0.0 onPremise

  •  Francesca Shiekh,

    I'm not sure what an Inbound Queue or a Case Queue is, but I suspect that there is an answer that will satisfy your needs.

    The outbound_email_id value is the ID of a row from the outbound_email table. Are you always using the same ID or are you using different ID's for each email that you are sending? For the ID(s) that you are using, what is the value in the corresponding row's "type" column? Is it "system", "system-override", or "user"?

    If the "type" is "system" then you can control the name that is used by editing the "From" Name field in the System Email Settings admin page.

    If the "type" is "system-override" then the name can't be changed because it is always the name of the user.

    If the "type" is "user" then you can change the name by editing the Name field on the resource. You would expand the Emails menu, click on Email Settings, click on the account you want to edit in the list view, and then edit the account.

    I'm guessing that if you go to Email Settings, then the list view will include all of the outbound email accounts that correspond to the Group Inbound email accounts you have set up. If one or more is missing, then you can simply create a new account in Email Settings. This would create a new account of type "user". Once you have the accounts configured with the name that you expect, then you can use the IDs for the value of outbound_email_id as you want. The name in the From address will be pulled from the name field of the account.

  • Thank you Greg Levine

    Sorry for the misnomers. By Inbound Queue/Case Queue I mean an entry in the inbound_email table. There is an email address associated with the InboundEmail record and I need all replies to Cases to use the address of the InboundEmail record as the From address. I believe the correct term in Group Inbound Email.

    In 7.x when setting the "Allow users to send emails using the "From" Name and Address as the reply to address" in the InboundEmail record I can see that address in the dropdown on the From line of the compose email. But in v8 that does not happen and the address is not an option.

    I have multiple InboundEmail records, each with its own Group Inbound Email address.

    There are logic hooks to set some custom fields like Department based on the InboundEmail that the case was created on. I use the email address as the InboundEmail module "name" field so I can easily retrieve it. 

    In 7.x, because the address is already an option in the From, I do nothing more than set it as the selected option in the From field. In 8.x I have to add them to the outbound_email before I can use them.

    Changing the type did indeed allow me to set the address and use its name.

    Thank you,


  • Greg Levine

    sadly any user who is not user.id = 1 regardless of whether they are admin or not, cannot see any system addresses, and therefore can only compose email coming from the address on their profile. So I'm back to square one.


  • Looks like what I want to do has been an enhancement request since 2011. Sigh.

    SugarCRM 44185 default outgoing email address

  • Francesca Shiekh,

    I have no issue with the misnomers. They probably aren't misnomers. A lot of this is always difficult to explain, even internally, because the names are poor.

    As of 7.10, you can only send using Sugar with an SMTP account that has been registered in the outbound_email table.

    Here's what I think I understand...

    As the admin, you visited the Inbound Email module. You clicked on "New Group Mail Account". You entered an IMAP account. You have "From Name" and "From Address" filled in. Can you tell me what checkboxes you have checked and the values of the other fields under "Email Handling Options"? Is there more than one Group Mail Account?

    A case has been created. You want to send an email from the case. It sounds like it is not an email that is automatically sent. What is the user doing to compose this email?

    From the Compose Email drawer, you want the user to be able to select a From account that has the same name and email address as defined in the "From Name" and "From Address" fields from your Group Mail Account.

    Could you answer those questions and confirm or deny if I'm understanding your workflow correctly?


  • Greg Levine,

    Everything you said is correct.

    I went in Admin->Inbound Email as francescas with Admin privileges and created multiple Group Mail Accounts

    They all substantially differ only in Name, Address and Team settings.

    There are a total of 20 such Inbound Email records in production, more like 5 in my development instance.

    I need them separate because I have a logic hook on the Emails module that sets defaults on the Case based on Team.

     Sasha, the customer, sends email info-dev

    Sugar creates a Case for CS WRI

    Patrick, a CS WRI regular sugar user goes to the Cases module's record view.

    In the Emails subpanel he has the standard out-of-the-box compose option and two custom options on the subpanel-top:

    and a number of custom options in the rowactions for reply, reply-all, and forward

    Patrick's User record has his email address in the Email Settings on User, and the Email Client set at Sugar Email Client.

    Regardless of the option Patrick chooses to compose the email (the stock "+" compose, custom subpanel-top actions, or custom rowaction) a compose Email drawer opens. (the custom actions add to-addresses, cc-addresses, and body templates as needed)

    For any and all the compose actions the From address should show as

    From: Customer Service <info-dev@....>

    Preferably with no option to change it.

    instead it shows

    From: Patrick Smith <patrick@...>

    and the Customer Service address is not an option at all.

    If we can solve this for the stock "+" compose on the subpanel-top I should be able to solve it for the custom actions.

    At the moment the only difference between the + and the custom actions is that the Email Ercipients fieldset does not open in edit view for the custom actions and I have to click on it to open, I have to find the best way to set the class for the email recipients:

    <span sfuuid="1187" class="email-recipients fieldset detail">

    instead of 

    <span sfuuid="1186" class="email-recipients fieldset edit">

    Thank you for your help,


  • Francesca Shiekh,

    I believe what you're really asking for is the ability to have shared outbound accounts; essentially shared by team. That's something that we're aware of, but there is a workaround.

    Each user needs to be able to essentially confirm access to an account that they can use. So assuming that there is one account that all users should share, you will want to have each user log in and add an account in Email Settings. I know this will result in duplicate accounts in the database, but each user will only the see the one that they created. The name they give the account and the email address that it is associated with just need to be entered the same for each user. Then, all users will be able to send email from that SMTP account. If you had 5 different outbound accounts, then you could do the same for each user that needed access to the different accounts.

  • Greg Levine

    I appreciate the suggestion, I will see if I can do this from the back end for all Customer Service and Technical Support users and test what consequences there may be to doing it this way. I have 20 or so InboundEmail addresses and some people need access to multiple ones.

    There is a bigger problem, it looks like even the stock compose on a Case email (both as a reply from the Emails module and from the Subpanel Top Compose (the +)) does NOT set the Reply-To to the InboundEmail address. (*) but rather to me, the user. So the customer's reply would go to the individual's mail server mailbox, not the Inbound Email Group Address. How is it no one noticed this?


    (*) to reproduce:

    Create a Case by sending an email to the InboundEmail address

    Go to the Case

    Go to the Emails subpanel and click on the Email Subject, this opens the Email record view.

    Click Reply, compose the email and send it.

    Go to the emails_text table, check the reply_to_addr field. It is null.

    Check the full headers for the email that was received, the reply-to is the individual's email not the queue.