Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Double Dot In Url #252

Closed
berridgeab opened this issue Oct 10, 2012 · 17 comments
Closed

Double Dot In Url #252

berridgeab opened this issue Oct 10, 2012 · 17 comments

Comments

@berridgeab
Copy link

Hello

Swift Mailer 4.2.1
PHP 5.3.5
Windows Server 2008

Swift Mailer seems to be adding a double dot to my message at random points. It seems to occur with some messages but not others. Always seems to affect a URL I add to the email. Reading through known issues this seems to be a known problem however none of the suggestions fixed it.

PHP Code as follows -

<?php

//Bug fix for dots
\Swift_Preferences::getInstance()->setCacheType('null');

//Mail (Transport Mail)
$swiftTransport = \Swift_MailTransport::newInstance("-f%s-t-i");

//Create the Mailer using your created Transport
$swiftMailer = \Swift_Mailer::newInstance($swiftTransport);

$messageSubject = "Ovenclean enquiry from www.aaaa.co.uk website on " . date("jS M Y H:ia");

//IT SHOULT OUTPUT https://www.aaaaaaa.co.uk/index.php 
//BUT THE RECEIVED MESSAGE OUTPUTS https://www..aaaaaaa.co.uk/index.php 
$messageBody = 
"A new enquiry has arrived!" . PHP_EOL . PHP_EOL . 
"Hi," . PHP_EOL . PHP_EOL . 
"A new Ovenclean enquiry (ID {$successfulRequestOvenClean->getId()} has been requested by {$successfulRequestOvenClean->getContactName()}." . PHP_EOL . PHP_EOL .  
"You can securely access the customers details by logging into https://www.smeg-service.co.uk/SVPortalV6/index.php and filling in your username and password." . PHP_EOL . PHP_EOL . 
"If you are having any issues you can contact Antony by emailing him on aaaaaa@aaaaa.co.uk" . PHP_EOL . PHP_EOL . 
"Regards" . PHP_EOL . 
"AAAAA Ltd" . PHP_EOL . 
"This is an automatically generated e-mail please don't reply to it.";

$msgRecipients = array("aaaa@aaaaa.co.uk");

//Create message
$swiftMessage = \Swift_Message::newInstance($messageSubject)
  ->setFrom(array('bbbb@aaaa.co.uk'))
  ->setTo($msgRecipients)
  ->setBody($messageBody, 'text/plain');

//Send message
@$swiftMailer->send($swiftMessage); 
?>
@berridgeab
Copy link
Author

Also reported here but no action taken

#180

@xdecock
Copy link
Member

xdecock commented Oct 11, 2012

http://tools.ietf.org/html/rfc5321#section-4.5.2

o Before sending a line of mail text, the SMTP client checks the
first character of the line. If it is a period, one additional
period is inserted at the beginning of the line.

o When a line of mail text is received by the SMTP server, it checks
the line. If the line is composed of a single period, it is
treated as the end of mail indicator. If the first character is a
period and there are other characters on the line, the first
character is deleted.

Check why your mail server does not respect RFC

Xavier

On Thu, Oct 11, 2012 at 10:20 AM, berridgeab notifications@github.comwrote:

Also reported here but no action taken

#180#180


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-9332085.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@berridgeab
Copy link
Author

Ok no worries, i'll close down if its definitely a mail server issue.

@xdecock
Copy link
Member

xdecock commented Oct 11, 2012

Do a test manually, the trick is to have a dot as first character of a line.

So a simple

HELO SMTP
MAIL FROM : authorized@mail.com
RCPT TO: your@mail.com
DATA
This is an RFC Test for my mail server
.. This double dot should be simple in the received mail
..
The previous line should only be a dot
.
QUIT

Should get you the info you need ;)

Xavier.
On Thu, Oct 11, 2012 at 11:55 AM, berridgeab notifications@github.comwrote:

Ok no worries, i'll close down if its definitely a mail server issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-9334479.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@berridgeab
Copy link
Author

Hi

Thanks for your help but I would not know where to execute this command. I'm not too knowledgeable with mailservers etc im just their PHP developer :(

@xdecock
Copy link
Member

xdecock commented Oct 11, 2012

oh, just telnet on port 25 ;)

On Thu, Oct 11, 2012 at 1:11 PM, berridgeab notifications@github.comwrote:

Hi

Thanks for your help but I would not know where to execute this command.
I'm not too knowledgeable with mailservers etc im just their PHP developer
:(


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-9336260.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@berridgeab
Copy link
Author

Dude your the best I learn something new everyday :)

The mail response I got was -

This is an RFC Test for my mail server
. This double dot should be simple in the received mail .
The previous line should only be a dot

I'm guessing because the double dot is not there the mail server is configured wrong or the mail server has a bug in it?

@xdecock
Copy link
Member

xdecock commented Oct 11, 2012

no, this is good, the strange part is that you should not receive your dot
at the end of the line but at the beginning.

On Thu, Oct 11, 2012 at 2:20 PM, berridgeab notifications@github.comwrote:

Dude your the best I learn something new everyday :)

The mail response I got was -

This is an RFC Test for my mail server
. This double dot should be simple in the received mail .
The previous line should only be a dot

I'm guessing because the double dot is not there the mail server is
configured wrong or the mail server has a bug in it?


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-9337754.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@berridgeab
Copy link
Author

The thing is the URL is not on a new line or anything. It just randomly adds a dot into the address breaking the URL.

Im only using the most basic mail transport.

Thanks for your assistance anyway.

@acajaja
Copy link

acajaja commented Aug 2, 2013

I'm having the same problem... random double dot in URL's thus breaking them. Please help!! This seems like a minor bug that's being left to persist. Swift 5.0.1

@hsteininger
Copy link

same problem here, please fix it, the users who get the emails don't understand the difference between, "URL is malformed" or "service is down"

@xdecock
Copy link
Member

xdecock commented Aug 8, 2013

Hello,

Can you please provide a reproducable test case ?

Your MTA name, version and configuration?

Because dot stuffing is required per RFC, so we need to be sure the bug is
not in your mta.

Thanks,

Xavier.

On Thu, Aug 8, 2013 at 11:43 AM, hsteininger notifications@github.comwrote:

same problem here, please fix it, the users who get the emails don't
understand the difference between, "URL is malformed" or "service is down"


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-22312960
.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@xdecock
Copy link
Member

xdecock commented Aug 8, 2013

For note:

http://tools.ietf.org/html/rfc5321#section-4.5.2

so we can limit discussions to the cases outside "double dot when dot is
the first caracter of the line."

Thanks all.

On Thu, Aug 8, 2013 at 11:45 AM, Xavier De Cock xdecock@gmail.com wrote:

Hello,

Can you please provide a reproducable test case ?

Your MTA name, version and configuration?

Because dot stuffing is required per RFC, so we need to be sure the bug is
not in your mta.

Thanks,

Xavier.

On Thu, Aug 8, 2013 at 11:43 AM, hsteininger notifications@github.comwrote:

same problem here, please fix it, the users who get the emails don't
understand the difference between, "URL is malformed" or "service is down"


Reply to this email directly or view it on GitHubhttps://github.com//issues/252#issuecomment-22312960
.

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

Xavier De Cock
GPG Fingerprint: 93CA EE3F 9F57 5BE1 AE4A 794D 3C74 CA9E E7A5 0C1B
GPG Id: 0xE7A50C1B

@hsteininger
Copy link

Sorry for answering so late.

Well, i have a php-script, which reads data from an mysql-DB, with this data i generate some URLs, which are not malformed, i put together an email with swiftmail to send it to "To" and "CC", send it to an smtprelay, which is postfix (2.7.1-1+squeeze1), the relay give the mails to the real mailserver, which is also postfix (2.9.6-2).
The User who gets the "To"-Mails don't have this problem, but the users who get the emails by "CC" get them sometimes malformed with double-dots in the URL.

Hope this helps.

If you need more info, just let me know.

Regards.

@webtechnick
Copy link

I'm having similar issues, however it's with a double dot in a price as apposed to a URL. It's only seems to be happening on BCC, verified I'm only sending a single decimal point in the email to the customer, however our BCC recipient will see a double decimal point.

@took
Copy link

took commented Sep 3, 2013

Same problem here. Tested with different Mailservers. In my case only Bcc-Recipients are affected. A particular text with a length that happens to be exact that long that a point "." at the end of a sentence is smtp-transferred at the beginning of a new line (due to encoding, "über" becomes "=C3=BCber", long lines are transferred wrapped but with a "=" at that position where the additional wrap occurs) is always displayed with two dots at the end of that sentence.

So even if the doubled dot seems not to be at the beginning of a new line, internally it happens to be a dot at the beginning of a new line.

Seems to be the same problem as described here
#62
(double escaping dots after already-escaped content is read from a cache and escaped again)

So I tried the fix suggested here, and replaced this code:
if (function_exists('sys_get_temp_dir') && is_writable(sys_get_temp_dir()))
{
Swift_Preferences::getInstance()
-> setTempDir(sys_get_temp_dir())
-> setCacheType('disk');
}

with this line of code:
Swift_Preferences::getInstance()->setCacheType('null');

This workaround fixes this bug for me (but since I'm sending quite large mails it's far from perfect to disable the cache...)

Seems like it's NOT a problem with the Mail-Server, but with the escaping of already escaped content after reading it back from cache.

@albertski
Copy link

I had the same issue in my body. It happened only on some urls. For some reason when my url ended like:
_rv1.html it would add an extra dot _rv1..html.

I had the same issue but in the body of the email. It adds an extra dot if your string has a dot as a beginning character(Beginning character of the filtered body).

This fixed the issue for me.
Swift_Preferences::getInstance()->setCacheType('null');

But I agree this isn't an ideal solution. I hope that the patch gets added in #62

xdecock added a commit to xdecock/swiftmailer that referenced this issue Dec 3, 2013
@fabpot fabpot mentioned this issue Dec 3, 2013
makasim pushed a commit to formapro-forks/swiftmailer that referenced this issue Jul 26, 2017
…cords

HipChatHandler: combine batch records and send as one
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants