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


    Francesca

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


    Francesca

Children
No Data