Project

General

Profile

Actions

Bug #35587

closed

SimpleMailInvoker as well as old Mail API break message on \n.\n

Added by Christoph Buchli almost 12 years ago. Updated over 11 years ago.

Status:
Rejected
Priority:
Won't have this time
Assignee:
-
Category:
-
Target version:
-
Start date:
2012-04-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

If you use the old Mail Delivery method by setting substituteMailDelivery = 0 or if you use the SimpleMailInvoker of Swiftmailer, a message breaks if it contains a single period on a line.

With Swiftmailer, the trick part is, that this not only happens by actually having a dot on a line for itself but also if you have a line with a dot at the end that happens to be 73 characters long: SwiftMailer breaks the message at the 72nd character which results in a cut message even if the content wouldn't actually have a "single period"-line.
(In my tests this happend even if the line wasn't exactly 73 characters long but don't ask my why ;)

This probably needs to be fixed in all TYPO3-Versions...


Files

35587_t3lib.diff (717 Bytes) 35587_t3lib.diff /t3lib/ part Christoph Buchli, 2012-04-03 09:47
35587_typo3.diff (685 Bytes) 35587_typo3.diff /typo3/ part Christoph Buchli, 2012-04-03 09:47

Updated by Christoph Buchli almost 12 years ago

Attached, I have a Fixe that worked for me in all tested cases (formmailer as well as powermail, both with the old MailDelivery as well as Swiftmailer SimpleMailInvoker).

However, this fix is only a proposition, since I don't know for sure if it does fix the problem in every possible usecase of SwiftMailer.

Actions #2

Updated by Jigal van Hemert almost 12 years ago

  • Status changed from New to Needs Feedback
  • % Done changed from 70 to 0
  • Complexity changed from hard to medium

Can you give some example code how to reproduce the problem?

Actions #3

Updated by Kevin Häfeli almost 12 years ago

We installed an introduction package (4.5LTS) on a server with the following setup:

PHP 5.3.3.7(squeeze8) & Suhosin
MySQL 5.1.61-0+squeeze1
Postfix 2.7.1-1+squeeze1

we're sending the mails directly over postfix.

You can input into the test form:

name: test
e-mail:
Address: Aenean ante elit, elementum et, varius ut, condimentum ut, sem
.
Aenean ante neque, imperdiet sed, ultricies vitae, aliquam dictum, arcu. Aenean arcu est, semper vitae, euismod quis, vehicula eu, risus.

--> the address text will "cut off" after "sem"

also not working with:

$TYPO3_CONF_VARS['MAIL']['transport'] = 'mail';
$TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = '1';

or:

$TYPO3_CONF_VARS['MAIL']['substituteOldMailAPI'] = '0';

Actions #4

Updated by Christoph Buchli almost 12 years ago

I encountered the problem in exactly the way khaefeli described in the last comment and was able to reproduce it the way he described with the introduction package.

As far as I was able to test it, the Fix I provided solved the problem with the old as well as the new API (using mail as transport, that is).

best regards,
christoph

Actions #5

Updated by Andreas Kiessling over 11 years ago

I can confirm the problem in 4.7.2
Mails from formhandler and direct_mail get cut off with the described problem.

Actions #6

Updated by Andreas Kiessling over 11 years ago

I found this bugreport: https://github.com/swiftmailer/swiftmailer/issues/136

But that fix seems to be already included in the version that ships with 4.7.2

Actions #7

Updated by Ernesto Baschny over 11 years ago

More probable is that you have changed your default php's "sendmail_path" setting.

The default from PHP is:

/usr/sbin/sendmail -t -i

See http://www.php.net/manual/en/mail.configuration.php

The -i means "ignore dots", which means a message might contain a "dot" and it won't stop processing it.

So maybe you just need to adjust that setting?

The mentioned fix (https://github.com/swiftmailer/swiftmailer/issues/136) only affects the SMTP-Transport (i.e. $TYPO3_CONF_VARS['MAIL']['transport'] set to smtp) and the code being reverted here is already fine in the currently shipped 4.5 - 6.0 Swiftmailer library.

Actions #8

Updated by Andreas Kiessling over 11 years ago

Ernesto Baschny wrote:

More probable is that you have changed your default php's "sendmail_path" setting.

The default from PHP is:

/usr/sbin/sendmail -t -i

And indeed, the hoster set this to

/usr/sbin/sendmail -t

Thanks for the hint!
@christoph - and khaefeli: can you please check your sendmail settings?

See http://www.php.net/manual/en/mail.configuration.php

The -i means "ignore dots", which means a message might contain a "dot" and it won't stop processing it.

So maybe you just need to adjust that setting?

I just realized after posting, that the fix is only for the smtp transport. Sorry for mixing that up.
Since the sendmail transport seems to automatically fix this issue, this will only be a problem for the mail transport.

Unfortunately, i have no access to the php.ini and i could not get the sendmail transport to work yet.
I really hate managed hosting...

Actions #9

Updated by Kevin Häfeli over 11 years ago

Andreas Kiessling wrote:

Thanks for the hint!
@christoph - and khaefeli: can you please check your sendmail settings?

We've: sendmail -t -f

So "-i" is an option - but I think that should also be solved in the core.
Finally: it's not a bug, it's a feature :-)

Actions #10

Updated by Andreas Kiessling over 11 years ago

Maybe a check in the reports module could help to identify a potential problem here, if the transport is set to "mail"

@Ernesto: is it safe to use this config for the sendmail transport?

$TYPO3_CONF_VARS['MAIL']['transport_sendmail_command'] = '/usr/sbin/sendmail -t -i'

With the default "-bs" option, i just get no mails out (probably due to some misconfiguration for the server), but "-t -i" works!

Actions #11

Updated by Kevin Häfeli over 11 years ago

Andreas Kiessling wrote:

Maybe a check in the reports module could help to identify a potential problem here, if the transport is set to "mail"

@Ernesto: is it safe to use this config for the sendmail transport?

[...]

With the default "-bs" option, i just get no mails out (probably due to some misconfiguration for the server), but "-t -i" works!

Yes, that should be no problem. The manpage from sendmail says:

-i When reading a message from standard input, don´t treat a line with only a . character as the end of input.

It's also PHP5 default, so I see no reason to configure php / sendmail without "-i"

Actions #12

Updated by Andreas Kiessling over 11 years ago

It's also PHP5 default, so I see no reason to configure php / sendmail without "-i"

Apparently, some hoster do that... PHP is not installed from the debian packages, so who knows for what reason -i was omitted.
For the record, this also works (because SwiftMailer catches the missing -i and applies the needed changes to the mail body):

$TYPO3_CONF_VARS['MAIL']['transport_sendmail_command'] = '/usr/sbin/sendmail -t'

Actions #13

Updated by Ernesto Baschny over 11 years ago

  • Status changed from Needs Feedback to Rejected
  • Priority changed from Must have to Won't have this time

This behaviour comes from a wrongly set PHP's "sendmail_path" setting.

The SwiftMail "sendmail" mailer transport (SendmailTransport.php) catches this and translates the "." for before sending it. This is the recommended setting!

This translation does not happen in the (not recommended) mail transport, as it relies that PHP's mail() is able to send a raw emails potentially containing dots.

So I wouldn't put more energy into it, and leave it as is, but at least it is now documented in the issue tracker and via google people will find it. :)

Actions

Also available in: Atom PDF