View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
15808Bug reportsSurvey editingpublic2020-02-03 11:11
ReporterWaterlijn Assigned ToDenisChenu  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version4.1.0 
Summary15808: Images in mailing not converted to CID
Description

When there are images in a mailing, the first mail will have a correct CID image, but the rest not.
A work around for this problem is to change the following script.

/application/controllers/admin/tokens.php
From line 1454

  • $mail = \LimeMailer::getInstance();
  • $mail = \LimeMailer::getInstance(\LimeMailer::ResetComplete);
  • $mail->setSurvey($iSurveyId);
  • $mail->emailType = $sSubAction;
  • $mail->replaceTokenAttributes = true;
  • $mail->addUrlsPlaceholders(array('OPTOUT', 'OPTIN', 'SURVEY'));
Steps To Reproduce

Use for example {SURVEYDESCRIPTION} in the e-mail template and add an image to the description like this.

<img src="/upload/surveys/663635/14016.tjp.jpg">

This won't work if there is a directory before '/upload/', but that's another (already reported) bug.
Send this to two or more addresses and you'll see that the second mail contains '/upload/surveys/663635/14016.tjp.jpg' instead of a CID.

TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)Versie 4.1.0+200128
I will donate to the project if issue is resolvedNo
Browser-
Database type & versionnot important
Server OS (if known)not important
Webserver software & version (if known)not important
PHP Versionnot important

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-02-01 18:10

developer   ~55613

What did you change
$mail = \LimeMailer::getInstance(); to $mail = \LimeMailer::getInstance(\LimeMailer::ResetComplete);

Bad idea : no need to reset completly. Must fix differently.

Waterlijn

Waterlijn

2020-02-01 18:27

reporter   ~55616

I know, but this works for now. There must be a better solution of course.

DenisChenu

DenisChenu

2020-02-01 19:49

developer   ~55618

OK : issue in $this->getIsHtml() checker …

Waterlijn

Waterlijn

2020-02-01 20:48

reporter   ~55619

It seems that phpMailer's '->ContentType' is reset. I think because it's a 'multipart' instead of 'text/html' after the presend or something like that.
The '->ContentType' has to be set again and might be done by inserting this after line 1454.
$mail->setSurvey($iSurveyId);

DenisChenu

DenisChenu

2020-02-02 10:29

developer   ~55621

I try to understand when/why it resetted :)

We set it here
https://github.com/LimeSurvey/LimeSurvey/blob/6129c136b701ff07736b3ab7393fb407c3b369ef/application/core/LimeMailer.php#L246

Maybe at https://github.com/LimeSurvey/LimeSurvey/blob/6129c136b701ff07736b3ab7393fb407c3b369ef/application/core/LimeMailer.php#L227

Then
self::$instance->setSurveyId(self::$instance->surveyIs);

Fix it at 100%, but i want to understand why it's needed before apply the fix :)

Waterlijn

Waterlijn

2020-02-02 11:25

reporter   ~55624

Here I guess.
https://github.com/LimeSurvey/LimeSurvey/blob/6129c136b701ff07736b3ab7393fb407c3b369ef/application/third_party/phpmailer/src/PHPMailer.php#L1437

DenisChenu

DenisChenu

2020-02-02 11:53

developer   ~55625

Yep, and there are potentially some other part resetted (header …)

DenisChenu

DenisChenu

2020-02-02 12:09

developer   ~55626

You can check https://github.com/LimeSurvey/LimeSurvey/pull/1381

Waterlijn

Waterlijn

2020-02-02 12:29

reporter   ~55628

Thanks!

DenisChenu

DenisChenu

2020-02-03 10:48

developer   ~55631

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=29481

ollehar

ollehar

2020-02-03 11:11

administrator   ~55634

Thanks, Denis!

lime_release_bot

lime_release_bot

2020-02-03 11:11

administrator   ~55635

Fixed in Release 4.1.1+200203

Related Changesets

LimeSurvey: master 2dc74449

2020-02-03 10:48:20

DenisChenu


Committer: GitHub Details Diff
Fixed issue 15808: Images in mailing not converted to CID (#1381)

Dev: Move ResetBase part to init
Dev: reset needed (and uneeded but seem cleaner) when init
Affected Issues
15808
mod - application/core/LimeMailer.php Diff File

Issue History

Date Modified Username Field Change
2020-02-01 12:21 Waterlijn New Issue
2020-02-01 18:10 DenisChenu Note Added: 55613
2020-02-01 18:10 DenisChenu Assigned To => DenisChenu
2020-02-01 18:10 DenisChenu Status new => assigned
2020-02-01 18:27 Waterlijn Note Added: 55616
2020-02-01 19:49 DenisChenu Note Added: 55618
2020-02-01 20:48 Waterlijn Note Added: 55619
2020-02-02 10:29 DenisChenu Note Added: 55621
2020-02-02 11:25 Waterlijn Note Added: 55624
2020-02-02 11:53 DenisChenu Note Added: 55625
2020-02-02 12:09 DenisChenu Note Added: 55626
2020-02-02 12:29 Waterlijn Note Added: 55628
2020-02-03 10:48 DenisChenu Changeset attached => LimeSurvey master 2dc74449
2020-02-03 10:48 DenisChenu Note Added: 55631
2020-02-03 10:48 DenisChenu Resolution open => fixed
2020-02-03 11:11 ollehar Status assigned => resolved
2020-02-03 11:11 ollehar Note Added: 55634
2020-02-03 11:11 lime_release_bot Note Added: 55635
2020-02-03 11:11 lime_release_bot Status resolved => closed