Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For a simplenews newsletter, I have a file attached for each issue. The URL to the attached file that is sent in the email and the link provided in the submitted node generate 404 errors.
Any help?
Thanks
mrweaver
Comment | File | Size | Author |
---|---|---|---|
#11 | drupal_wrap_mail_line.diff | 777 bytes | Dave Cohen |
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedNo activity, closing the issue.
Comment #2
redsky CreditAttribution: redsky commentedI found the same thing, what I found is files with spaces in them were getting "double spaces" in the generated url, but just in the email, not the link on the website.
Comment #3
redsky CreditAttribution: redsky commentedI'm changing this to a bug report. Can anyone help?
When files are attached, the email actually shows the attachment in two ways. First it is physically attached to the email - great this works. Second there is an "Attachments" section at the bottom that lists files and their sizes with links to the files on the website. This looks just like the website does, however the link does not work. It adds a second space (%20) for one of the spaces in the file name. Even stranger it is not consistent which one of the spaces is doubled, in one file the second space was doubled, in another the third space was doubled.
For example, on this node: http://www.bedfordscouts.ca/cubs/posting/1st-bedford-b-cub-pack-fall-camp
The email generated the link incorrectly: (notice after the word Bedford in the file name - two %20)
The website generated the link like correctly. (notice after the word Bedford in the file name - one space)
Honestly I'd prefer to only have real attachments and not links to the attachments in the emails but if they're going appear as links they need to work.
Thanks,
Chris
Comment #4
redsky CreditAttribution: redsky commentedI just noticed a bit more. Below is the whole HTML source for the attachments table from the email. Notice that the double %20 appear on the space next to the line break. I don't know what this means but more knowledge might someone help me out here.
Comment #5
Sutharsan CreditAttribution: Sutharsan commentedThere is also a issue in the queue about converting spaces into %20. I'm not sure is these are simplenews or mime mail issues. Please check the mime mail issue queue too. and make sure you use latest development versions of both modules!
Comment #6
Sutharsan CreditAttribution: Sutharsan commentedWith this issue #291903: Properly convert file URLs to paths the space to %20 conversion was added mimemail. And from the size of the issue, this is a complex matter.
Moving this to mime mail.
Comment #7
marcvangendIs there any progress on this issue? I have been looking at the _mimemail_url() function but I can't see why it would cause incorrect url's. Any thoughts, or suggestions where I should start fixing this bug?
Comment #8
sgabe CreditAttribution: sgabe commentedThis is not a Simplenews, neither a Mime Mail but a core bug. The space character is unsafe, so it must always be encoded according to RFC 1738. This cause no problem at all. The problem is with the duplicate white-spaces. See, these links will not work even when the spaces are not encoded.
The source of the problem is that drupal_wrap_mail calls _drupal_wrap_mail_line which will do soft-breaks like
\n
and break the URL of an e.g Upload module attachment.There is a similar issue #506112: wrong line wrapping on drupal_wrap_mail() in mail.inc so this could be a duplicate, but for now I just change the issue details and let somebody else to decide.
Comment #9
mcfilms CreditAttribution: mcfilms commentedSo the file name has a space in it: "kittens play.jpg" Mimemail correctly encodes the space as %20 but Drupal core is ALSO changing the space (white space) and including it. Is this the issue?
So, how does IMCE deal with this? Using CKeditor and IMCE you can upload just about anything you want, with as many spaces as you want. It all works. I'll tell you. It swaps a hyphen for the space right away and then uses that file name throughout. Is there a way that this way of handling image names can be ported over either to core or to mimemail?
Comment #10
Dave Cohen CreditAttribution: Dave Cohen commentedI have the same problem.
I'd like some way to disable entirely any wrapping when the mail is HTML.
I'm using combination simplenews and mimemail.
Comment #11
Dave Cohen CreditAttribution: Dave Cohen commentedHere's a change that does not change Drupal's default behavior in any way, yet allows admins to disable or change the length of line breaks.
To disable, I add this to settings.php:
$conf['drupal_wrap_mail_line'] = 0;
Comment #13
STNyborg CreditAttribution: STNyborg commentedI was not aware that I had the same problem until one of my newsletter readers complaint about failing URL links to attachments with spaces in the filenames.
I have searched high and low without any luck. Is anybody else aware about whether or not there is an updated workable solution to this problem?
As [#10] Dave Coven, I'm also using a combination of simplenews and mimemail.
Thanks,
STNyborg
Comment #14
eric.chenchao CreditAttribution: eric.chenchao commentedI have also encountered this problem and spend couples of hours to find it out. For the time being I just increase the 77 into a big number like 100. I think text wrap is useful for plain-text email, but we can use CSS to control the width of content.
Comment #15
mattrweaver CreditAttribution: mattrweaver commentedI added a filefield to the newsletter content type to put my pdfs in and it works fine now.
Comment #16
walker2238 CreditAttribution: walker2238 commentedSubscribing. :( Sorry.
Comment #17
funkytraffic CreditAttribution: funkytraffic commentedI am not sure if this issue is related or I should open a new thread.
I am working with Mimemail and siplenews. I have an image included with an absolute path.
_mimemail_url gives me a double %20%20 instead of the space in the first if-statement. I cannot figure out why.
All other filters are turned off, so mimemail must be the culprit. Either the function gets called twice in a wrong way, or somewhere else the space gets doubled?
Comment #18
funkytraffic CreditAttribution: funkytraffic commentedIf drupal_wrap_mail is the culprit, why don't you write a new function mimemail_wrap_mail for this module?
Comment #19
Hanno CreditAttribution: Hanno commentedsubscribing
workaround: use http://drupal.org/project/transliteration as mentioned in http://drupal.org/node/488508#comment-2112008
Comment #20
funkytraffic CreditAttribution: funkytraffic commentedAnother workaround I use:
Use Filefield and Imagefield for files (if not external), use Filefield Path to clean URL and Insert to put them into the newsletter.
Spaces should not be in a newsletter file anyway, since we donnot know the OS of the receiver.
Though this does not work for external urls. In this case I save the newsletter, copy the URL and insert it again. For other user I put an advice in the header.
Anyway the file handling by Simplemail+Mimemail should be improved, allowing integration or extegration of files not on absolute or relative path but by option and allowing file name convention like in FileField Path.
Comment #21
wojtha CreditAttribution: wojtha commentedSimilar to #1328696: Problem with _drupal_wrap_mail_line and attachment files