Bug #37594

Old swiftmailer implementation in 4.5 and 4.6 prevent direct_mail from working properly

Added by Alban Cousinie over 9 years ago. Updated almost 6 years ago.

Should have
Backend API
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


As discovered when investigating issue 37375 the old swiftmailer implementation present in Typo3 4.5 and 4.6 can raise error messages during mail sending with direct mail.

This bug has been fixed in the swifmailer 4.1 release and thus is no longer present in Typo3 4.7, which already benefits of the swiftmailer 4.1.3 implementation.

We beleive Typo3 4.5 LTS should also benefit from this upgrade as it could prevent newer versions of direct_mail from working properly. As a consequence, Typo3 4.6 should ideally be upgraded as well.


patch.diff (1.14 KB) patch.diff Sylwester Szytuła, 2012-10-05 20:29

Updated by Jigal van Hemert over 9 years ago

  • Category set to Backend API
  • Status changed from New to Accepted

Release managers need to decide, but I don't think it'll be a problem.


Updated by Gsnerf no-lastname-given about 9 years ago

Has anyone tried if this actually fixes the problem? (The problem is that html newsletters send with direct_mail are not send out completely but chopped of when too long and external files are not embedded.)

I tried replacing the swiftmailer implementation in typo3 4.5 (4.0.6) with the one used in typo3 4.7 (4.1.3) as well as the current stable release (4.2.1) and none of those fix the problem. The error persists and the mails still get chopped of.


Updated by Sylwester Szytuła about 9 years ago

I had the same problem with direct_mail 3.0.2 and typo3 4.5.12. The "test mail" was sent correctly, but mass-mailing was incorrect, body of mail always were cutted off just after template's last line, so there was no media data and last bounderies ending the body mail.

In BE log there was error "stream does not support seeking in ...... typo3_src-4.5.12/typo3/contrib/swiftmailer/classes/Swift/ByteStream/FileByteStream.php line 137".
I have looked into this file and the error occur in function _getReadHandle().

I just replace only this one function to new one which I had copied from swiftmailer delivered with typo3_src-4.7.4.tar.gz and it's work. I don't know if there are any problems connected with this code replacing, but for me everything works fine.


Updated by Ernesto Baschny about 9 years ago

Two potential solutions:

  • backport that particular fix to 4.5: less trouble and risk of other "incompatibilities", but of course a branched custom version of SwiftMailer
  • upgrade Swiftmailer in 4.5: stay in line with future TYPO3 versions, but with the risk that something break (imagine an extension that might have extended some Swiftmailer class, for which the API or signature changes: it might break, which is unexpected on a minor TYPO3 upgrade).

If we could get the first variant to work, it could be a first small step, and we can simply merge such a bugfix (once tested and proven to work) in a minor release without a problem.

If it turns out that we have tons of other "bugs" from older Swiftmail that we need or want to get fixed (I know of no other "specific" problem), then of course we could think about the whole upgrading process, which would require much more testing, API checks, and maybe even documentation / announcement for the release.

Keep in mind that we want to minimize the annoyment of people on patchlevel upgrades (especially for the LTS). :)


Updated by Ernesto Baschny about 9 years ago

Keep in mind also that somehow the upgrade of Swiftmailer in 6.0 is stalled because of the open licensing question. See #38145


Updated by Simon Schaufelberger about 9 years ago

Hi Ernesto,
can you please publish the patch so that i can use it as well? I have the same problem.


Updated by Ernesto Baschny about 9 years ago

Simon Schaufelberger wrote:

Hi Ernesto,
can you please publish the patch so that i can use it as well? I have the same problem.

Which patch you mean? I currently have no patch, I was just commenting on the matter from the point of view of the release manager of 4.5. :)


Updated by Simon Schaufelberger about 9 years ago

oh sorry Ernesto, i meant Sylwester Szytuła.


Updated by Sylwester Szytuła about 9 years ago

Here you go Simon. I hope it will work for you.


Updated by Stefan Neufeind almost 9 years ago

Regarding ExtJS I was once told that we don't modify contrib-packages, no way. Hmm ... :-(


Updated by Ernesto Baschny almost 9 years ago

Backporting a fix from an upstream open source compatible project is perfectly valid. The benefits outweight the drawbacks. We don't need to further enhance or work with SwiftMailer for 4.5, we just want to fix tiny bugs in the existing package. Same motto as Debian Package maintainers.

We have to make sure:

a) Bug is really fixed by the change? No other harm is done?

b) If the bugfix was backported to 4.5 LTS + 4.6, is the fix included in the 6.0 SwiftMailer already? I guess so, once it is updated to latest version.

This is way less intrusive for the users of 4.5 LTS than upgrading the whole SwiftMailer API (potentially introducing other bugs, regressions etc).


Updated by Manuel Link about 8 years ago

is there any update on this?

we are currently having issues with Direct Mail sending mails without images through Swiftmailer 4.0.6 (Typo3 4.5).
This is already resolved in version 4.3.1

is there any problem with upgrading future releases of 4.5 and 4.7 to Swiftmailer 4.3.1?


Updated by Philipp Gampe about 8 years ago

  • Complexity set to easy

Apparently nobody did this so far. I do not expect problems, but it needs some time to verify, port and test it - especially because 4.5 is in LTS stability period (security and priority bugfixes only).

Thus we need to make sure that the whole thing is stable - and somebody has to actually do it ;)


Updated by Jigal van Hemert about 8 years ago

As you can read from the comments of the Release Manager (Ernesto), updating the entire swiftmailer library seems out of the question. He would like to see this single bugfix in the swiftmailer we ship included. If someone can do that and push it to gerrit it can be included in a future update of TYPO3 4.5.


Updated by Gerhard Rupp about 8 years ago

As we also have trouble with the outdated Swiftmailer shipped with TYPO3 4.7 I would recommend to update Swiftmailer to the last 4.x version. There should be neither problems conecerning the licensing issue nor any changes to the API as the major version doesn´t change.
For the moment we use the 4.3.1 in a few installations with TYPO3 4.5 and 4.7. We didn´t get any problems for a few months now. The broken images (timing problem: mail got sent before the temporary binaries ar created) in Direct Mail have gone since the update.


Updated by Simon Schaufelberger over 7 years ago

current version in typo3 master is Swift-5.0.3. can this be backported? then i will submit a patch


Updated by Stefan Neufeind over 7 years ago

  • Is Regression set to No

We can't move 4.5 (stable!) to a new major-version of SwiftMailer imho. I'd be okay with the latest 4.x-version (same major-version). But reading the ticket again Ernesto seems to prefer the patch-backport-variant.
So could you have a look at the patch maybe, if that was the official way of fixing it in later versions, check if that fixes the problem, and then submit it to 4.5?


Updated by Gerhard Rupp over 7 years ago

I can´t confirm that applying the patch resolves that issue. We again had to update to Swiftmailer 4.3.1.


Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Accepted to Needs Feedback

What about the most recent versions like 6.2.12 or 7 (master)? Does this still apply?


Updated by Stefan Neufeind over 6 years ago

Riccardo: As written in the issue newer versions should already be fine (4.7 and after). So since version between 4.6 and 6.1 are no longer under maintenance this is just about a solution for 4.5.


Updated by Riccardo De Contardi over 6 years ago

Stefan: If you agree, I would close this, as 4.5 is not under manteinance any longer, too


Updated by Stefan Neufeind over 6 years ago

  • Status changed from Needs Feedback to Closed

of course you're right, thanks


Updated by Gerhard Rupp over 6 years ago

The problem still exists with direct mail mass mailings in TYPO3 6.2.14 (which contains swiftmailer 5.0.3).
Images in some mails get corrupted. Updating swiftmailer to version 5.4.1 resolved the issue.
Therefore TYPO3 should be shipped with an updated version of swiftmailer.


Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Closed to New

Updated by Riccardo De Contardi about 6 years ago

In version 7.6-dev (latest master) the version of swiftmailer is 5.4.1.

Is it sufficient to consider this closed? Will the version shipped with 6.2.x be updated?


Updated by Gerhard Rupp almost 6 years ago

Problem still exists in TYPO3 6.2.15.

Therefore I still had to patch swiftmailer manually to 5.4.1.

Could anyone tell me what´s the problem to ship also TYPO3 6.2 with this version?


Updated by Stefan Neufeind almost 6 years ago

The "problem" is that TYPO3 tries to avoid patching third-party-libraries as much as possible and report problems upstream (even providing patches). The patch is already under review on their github-repo, so I wonder why they don't consider shipping it and not even commenting on the pull-request. Maybe we should try to get the ball going on the swiftmail-team-site at Github?


Updated by Stefan Neufeind almost 6 years ago

Oh wait, Github says that above linked patch is in swiftmailer 5.4.1. We have 5.0.3 in the 6.2-tree. Hmm, needs a solution then ...


Updated by Christian Kuhn almost 6 years ago

What a mess here.

Sum up:

There was an issue with swiftmailer for direct_mail and core 4.5, 4.6 in the past that issues "errors" on sending test mails. According to Gerhard Rupp a year ago, this is fixed by ugrading Switfmailer to 4.3.1.

Then, there is a (different?!) issue that pops up in core 6.2.14 with direct_mail that "images in some mails are corrupted" that goes away with upgrading to 5.4.1. core 6.2 currently delivers swift 5.0.3.

All in all, this issue here is rather messy, it mixes 4.5 with 6.2, it seems to mix different issues, it lacks proper issue description and how-to-reproduce. Hard to follow.

4.5 not get updates any longer, so this is out of question.

6.2 will only get an update of swift if we're really very sure it can not break anything (it would be a pretty big version jump), and if the issue is considered important enough - a relatively obscure issue like "6.2 in direct_mail test mails sometimes sends funny images" doesn't really sound like a critical blocker at first glance and also not too many people are screaming currently.

For the sake of a better overview of this issue I'll now do the following: I'll close this issue here. If reporter or other people think we still should touch switftmailer in 6.2, then please open a new issue, relate it over to this one here (for history for interested people), and then please add proper issue description - how-to-reproduce, the issue itself, which versions are affected - just more solid information so a sane decision or a patch could be based on it.


Updated by Christian Kuhn almost 6 years ago

  • Status changed from New to Closed

Also available in: Atom PDF