SuiteCRM icon indicating copy to clipboard operation
SuiteCRM copied to clipboard

Fixed #8336 - bug: Compose Email Page Lacks "FROM NAME" in HTML value…

Open marcoblancas opened this issue 2 years ago • 1 comments

Description

Fix issue #8336 and probably #9023 and #8959 could be closed.

Motivation and Context

"From name" set up in "User Profile > Settings > Mail Accounts" in Outgoing mail accounts is not populated when sending emails from Emails ComposeView. The same happens with the " Reply to Address" users set up in the mail accounts (inbound) related with Outgoing mail accounts (see red boxed filed in screen capture below).

imagen

so when the mails arrive to destination clients see this in the mail heads:

From: "[email protected]" [email protected] Reply-To: [email protected]

mail heads should be.

From: "SINESIA Sánchez" [email protected] Reply-To: "SINESIA Sánchez" [email protected]

How To Test This

  • Set up at less two mails accounts in a regular user with two different outgoing mail accounts with something like above screen capture.
  • Send mails from the "Email > Compose"
  • "Reply" received emails from the DisplayDetailView "Email".
  • Send mails from a "Lead" detail view using "Create Task > Compose mail"
  • In all your test... review mail heads received in destination.
  • If you want you can try to launch a mail "Campaign" in order to verify that nothing is broken there.
  • Compose mails in the Emails module and save them as "Drafts", and sent them later.

Changes explanation

Basically "from_addr_email" was replaced by "from_addr" in populateBeanFromRequest because "from_addr" is how it is named in the email bean when populating from $request.

In the mails ComposeView.tpl was required to add these fields in order to be sent in $_REQUEST:

    <input type="hidden" name="from_addr_name" value="">
    <input type="hidden" name="reply_to_addr" value="">

Finally some fix was made in EmailsComposeView.js in order to populate this fields with the selected mail account user selects or change in the "From:" select.

No extra DB queries are required with this approach.

Types of changes

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • [X] My code follows the code style of this project found here.
  • [ ] My change requires a change to the documentation.
  • [X] I have read the How to Contribute guidelines.

marcoblancas avatar Mar 24 '22 15:03 marcoblancas

I created this little hack and it does now what I want it to do.

It checks if the smtp from name is set and then uses it.

In file : /public/legacy/modules/Emails/Email.php Line nr: 2985

    // FROM NAME
    if (!empty($this->from_name)) {
        $mail->FromName = $this->from_name;
    }elseif (!empty($mail->oe->smtp_from_name)){
    // fix

        $mail->FromName = $mail->oe->smtp_from_name;

    // fix
    }elseif (!empty($this->from_addr_name)) {
        $mail->FromName = $this->from_addr_name;
    } else {
        $mail->FromName = $current_user->getPreference('mail_fromname');
        $this->from_name = $mail->FromName;
    }

jessec avatar Jul 24 '22 07:07 jessec

So at the end was this fix included in some release of suitecrm?

maurizioaiello avatar Dec 31 '22 23:12 maurizioaiello

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/error-in-the-from-field-of-e-mail-sent/77941/8

SuiteBot avatar Dec 31 '22 23:12 SuiteBot

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/critical-bug-9023-will-it-be-solved/87469/4

SuiteBot avatar Jan 02 '23 13:01 SuiteBot

Please merge this pull request. I tested it, and it works, it solves the #9023 bug.

maurizioaiello avatar Jan 03 '23 05:01 maurizioaiello