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.

  • 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

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

    Thanks

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

    FrancescaS

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

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

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

    Francesca

    (*) 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.