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.

In 

include/javascript/sugar7/utils.js

the comments on the function

prepopulateEmailForCreate

include 

         * @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 

include/javascript/sugar7/plugins/EmailClientLaunch.js

The

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 

modules/Emails/clients/base/views/fields/from

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,

FrancescaS

Parents
  • 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,

    Francesca

    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.

Reply
  •  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.

Children
  • 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,

    Francesca

  • 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.

    Francesca