Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Newsletter is different in Test to Live


Reply

4 Posts   499 Views

Avatar
AndiC

21 October 2013 at 12:36pm Community Member, 4 Posts

Sharp intake of breath - my first post here.

I have been using SS for some months now with mostly good results, but recently came across a problem with teh Newsletter Module in SS 3.1.1

When I send a test email, everything is fine - but - when I send out a live email the formatting of links is destroyed.

Sample would be a hyperlink http://mywebsite.com is replaced with /var/www/mywebsite/newsletterlinks/bd9cd393e8add09d3e60d3c3b7da035f - which obviously doesn't work.

Links to embeded images are likewise corrupted

I've looked, but can't see anything similar here - any help appreciated

Andy

My composer.json
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.3.2",
"silverstripe/cms": "3.1.1",
"silverstripe/framework": "3.1.1",
"silverstripe-themes/simple": "*",
"titledk/cloudy": "dev-master",
"silverstripe/widgets": "*",
"silverstripe/blog": "*",
"simplepie/simplepie": "*",
"silverstripe/comments": "*",
"silverstripe/userforms": "*",
"ezyang/htmlpurifier": "*",
"silverstripe/file-listing": "*",
"purplespider/basic-galleries": "dev-master",
"silverstripe/newsletter": "*",
"silverstripe/spamprotection": "*",
"silverstripe/recaptcha": "*",
"silverstripe/docsviewer": "*",
"silverstripe/behat-extension": "*",
"silverstripe/buildtools": "*",
"silverstripe/googlesitemaps": "*"
},
"config": {
"process-timeout": 600
},
"minimum-stability": "dev"
}

Avatar
Sygmoral

13 January 2014 at 6:13am (Last edited: 13 January 2014 6:13am), Community Member, 23 Posts

I just recently installed the dev-master (because older wouldn't work on SS 3.1), and have the same problem. I'm trying to find how to fix it, hoping I will in time before presenting it tomorrow.

In any case, I think I'm interested in contributing to this module (since I need it myself anyway). It looks like it has a lot of interesting features, but a lot of them are currently broken.

I have never really contributed to an open source project before. Should I contact someone first, or just start making changes and uploading them as patch suggestions on github or something?

Avatar
Sygmoral

13 January 2014 at 9:00am (Last edited: 13 January 2014 9:24am), Community Member, 23 Posts

Took me longer than it should have, but the issue is the queued message sending, because requests on those do not occur from a normal HTTP request, and therefore SilverStripe's base_tag is wrong.

This causes the URLs in the queued emails to be messed up with absolute URLs to the filesystem, rather than to the website URL.

Is there a clean way to set the CORRECT SilverStripe base directory upon its startup? Isn't that saved somewhere? Then it could revert to that when it can't find it from the _SERVER variable.

For now, I'm using a hardcoded workaround, replacing the long filesystem path with the website path (at the start of Mailer::sendHTML). I also had to disable tracking, since the original URLs had the filesystem path in them too, and I didn't want to start checking how to work around that too just yet (NewsletterEmail::_construct, disable the entire if clause starting on line 72).

If the base_tag issue for queued requests can be fixed, it would solve these issues in a better way.

Avatar
Sygmoral

24 February 2014 at 5:33pm (Last edited: 24 February 2014 5:35pm), Community Member, 23 Posts

I found a better way to fix this issue: in my website's _config, I now have this:

if(!$_SERVER['HTTP_HOST'])
Director::setBaseURL('http://www.example.org/');
// put your own website there, including the / at the end

That makes sure that Director does not totally mess up the base directory when SilverStripe is called from cron, or whatever it is that messagequeue does in order to send newsletter emails. This makes it so that the newsletter module works again, with link tracking and everything.

Now, on to making the images tracable... which I suppose is 100% new work.