Image Path for Emails uses private site url; want to hard code path to public folder for emails

Long subject…

We use SuiteCRM, but requires VPN to access it, until now…I have had my engineering team setup a public url to access it because we want to leverage more of the email capabilities (tracking links, campaign tracking, etc…)

The tracker links work well because I was able to setup the proxy link in the settings.

The images that are attached however, are retaining the private link, even if i use the path with the public url in the image field SOURCE field and save it.

Questions are:

  • Can the path be hard coded in the php configuration for mailing? I believe it is the phpmailer.php file that requires it

  • Is there a better way, do I have to change the siteurl in the config files?

  • is there another solution…

    /**

    • Add an embedded (inline) attachment from a file.

    • This can include images, sounds, and just about any other document type.

    • These differ from ‘regular’ attachments in that they are intended to be

    • displayed inline with the message, not just attached for download.

    • This is used in HTML messages that embed the images

    • the HTML refers to using the $cid value.

    • Never use a user-supplied path to a file!

    • @param string $path Path to the attachment

    • @param string $cid Content ID of the attachment; Use this to reference

    •                        the content when using an embedded image in HTML
      
    • @param string $name Overrides the attachment name

    • @param string $encoding File encoding (see $Encoding)

    • @param string $type File MIME type

    • @param string $disposition Disposition to use

    • @return bool True on successfully adding an attachment
      */
      public function addEmbeddedImage($path, $cid, $name = ‘’, $encoding = self::ENCODING_BASE64, $type = ‘’, $disposition = ‘inline’)
      {
      if (!static::isPermittedPath($path) || !@is_file($path)) {
      $this->setError($this->lang(‘file_access’) . $path);

       return false;
      

      }

      // If a MIME type is not specified, try to work it out from the file name
      if (’’ == $type) {
      $type = static::filenameToType($path);
      }

      $filename = basename($path);
      if (’’ == $name) {
      $name = $filename;
      }

      // Append to $attachment array
      $this->attachment[] = [
      0 => $path,
      1 => $filename,
      2 => $name,
      3 => $encoding,
      4 => $type,
      5 => false, // isStringAttachment
      6 => $disposition,
      7 => $cid,
      ];

      return true;
      }

Setup:
v 7.11.4
Php 7.2
Ubuntu
Apache 2.4.29
database: mysql
Email Editors: Tried both Moziak and TinyMCE

Ok, so I have reviewed a number of other issues raised by the community and it seems like multiple people have had the issue that I describe. I will simplify what is going on and maybe someone can assist further.

  1. Our CRM is running on a private server but we have a public proxy URL that can be used to access
  2. When I hardcode the public URL, which is suggested in many articles as the correct way to do this image insert, the url is truncated in the prefix.
    insert: https://{myurl}/public/5e134a49-e7f4-95e0-9e77-5d7fdfcf9925.png
    end up with: public/5e134a49-e7f4-95e0-9e77-5d7fdfcf9925.png

This fails to include the image in the email…really annoying as I want to start using the email campaings more instead of mail merge…and dont want to get another service at this point…mailchimp, etc…and then integrate or do a lot of back and forth for tracking…

Tracker Links
These work fine with our proxy settings so I know this is not an issue at this time.

References:
https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/20930-email-template-issue-uploading-images
https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/7916-how-to-add-images-to-an-email-template
https://support.sugarcrm.com/Knowledge_Base/Email/Embedding_Images_in_Emails/index.html

Quick note…I tried this using the HTML editor…and it worked…Not ideal for sending messages since I want non technical people to actually input content…

PLEASE HELP to see if there is a bug in the other editors…seems like there is…or that an improvement is required for how the path urls are saved/constructed if someone chooses to hardcode the public url path.

I found another git bug tracker…

https://github.com/salesagility/SuiteCRM/issues/1521

It seems like even in April people are still asking for this particular feature to be corrected…

What is the hold up on this fix? Looks like the community is interested and this feature is certainly helpful to those of us trying to use the campaign feature.

Anyone that can help, it is appreciated.