CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Can't see public mailings if not logged in
Pages: [1] 2

Author Topic: Can't see public mailings if not logged in  (Read 2216 times)

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Can't see public mailings if not logged in
February 18, 2014, 11:25:46 am
In CiviMail, when creating a mailing, if you set the Mailing Visibility to Public Pages, then it should be possible to view the mailing as a web page even when you're not logged in. However, that is not working for me.

In order for mailings to be accessible when not logged in to Drupal, you need to give the "view public CiviMail content" permission to anonymous users in Drupal. I have done this.

The URL for viewing a mailing is given by the {mailing.viewUrl} token, and it looks like http://www.example.org/civicrm/mailing/view?reset=1&id=1 where the id in the query string is the ID of the mailing.

When I log out and then try to view a public mailing in a browser I just get a completely blank page and an error in the CiviCRM log file, which says "CiviMail will not send email to a non-existent contact". This error is raised in CRM_Mailing_BAO_Mailing::compose - the function that generates the mailing output. It seems that the function cannot complete without the details of a specific contact, which are obviously not present when the page is viewed as an anonymous user.

This is happening in CiviCRM 4.4.4. Is anyone else experiencing this error? Any idea how to fix it?

Thanks.
« Last Edit: February 18, 2014, 11:29:29 am by kirk »

planetwebb

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Joomla 2.5.28 / Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.22
Re: Can't see public mailings if not logged in
February 18, 2014, 01:54:22 pm
I think you still need the checksum to see the mail content, the intent is to allow a known viewer to see the email without logging in.

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 18, 2014, 03:25:16 pm
No, the documentation makes it quite clear that this method should "make the mailing content available for the public," and the URL it gives - the same one generated by the {mailing.viewUrl} token - does not contain a checksum.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Can't see public mailings if not logged in
February 18, 2014, 04:48:53 pm
The CiviCRM community newsletter is an example of a public mailing that you can view anonymously:
https://civicrm.org/civicrm/mailing/view?reset=1&id=450

I suspect that you are getting that error because you have contact-specific tokens in the mailing body which compose() is trying to evaluate - e.g. {contact.email_greeting}. If that turns out to be the cause, would be good to update the doc with that caveat. Not sure if there's a 'fix' for this behavior without a checksum to grab an associated contact record.
Protect your investment in CiviCRM by  becoming a Member!

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 18, 2014, 05:23:49 pm
Thanks for the suggestion Dave, but no that's not it. Even without any tokens in my mailing, the view page still doesn't work when I'm not logged in.

Is civicrm.org running version 4.4.4? Is anyone else getting this problem? Perhaps I'll have to try to work out what the code's supposed to be doing...

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Can't see public mailings if not logged in
February 18, 2014, 11:29:36 pm
civicrm.org/civicrm is 'saying' it is on 4.4.2 but this might not have updated even though the code may have been updated depending on the approach used - but yeah it does seem possible that it isn't running latest - are you suggesting this is a regression?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 18, 2014, 11:49:19 pm
I don't know if it's a regression but it's a possibility. There were a number of changes to CRM/Mailing/BAO/Mailing.php in 4.4.4. It would be good to hear from someone using 4.4.4 as to whether they can view public mailings when logged out. If so, then we can rule out a regression.
« Last Edit: February 19, 2014, 12:48:52 am by kirk »

michael23

  • I’m new here
  • *
  • Posts: 24
  • Karma: 2
  • CiviCRM version: 4.6.2
  • CMS version: Joomla 2.5.28
  • MySQL version: 5.6.23
  • PHP version: 5.5.22
Re: Can't see public mailings if not logged in
February 19, 2014, 12:04:34 am
Hi Kirk,

I'm having the same problem, though running on Joomla. Blank page.

I'm also interested about point raised about token expansion. What happens to them when viewed as a public page?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Can't see public mailings if not logged in
February 19, 2014, 12:38:16 am
just tried this on a site on 4.4.4
set permissions so Anon can see public mailings
set civimailing to be public
got this from the link from the token

Fatal error: Call to a member function getHTMLBody() on a non-object in .../sites/default/modules/civicrm/civicrm-core/CRM/Mailing/Page/View.php on line 154

but could be a red wild goose since no one else is pasting errors here
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 19, 2014, 02:00:23 am
Thanks Michael. I'm interested in the answer to that question too. I notice that even when you're logged in, when you view a mailing as a web page, the identifying information, including the contact checksum, is stripped from the query string in the URLs generated by the {action.unsubscribeUrl} and {action.optOutUrl} tokens. You can see this in the footer of the newsletter that Dave's linked to. This suggests that it should be possible to view mailings containing contact-specific tokens when logged out.

Pete, I'm not sure at what point you're getting that error, but it's definitely not the same error that Michael and I are getting when we try to view a public mailing in a browser when logged out.

Anyone else using CiviCRM 4.4.4? Unless someone can confirm that this feature works in 4.4.4, I'll raise it as a major bug in the issue tracker.
« Last Edit: February 19, 2014, 02:22:33 am by kirk »

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: Can't see public mailings if not logged in
February 19, 2014, 04:31:14 am
rightly as Dave as suggested above, without the contact specific tokens, anonymous users can view public mailing on browser (tested on 4.4.3)
How can we handle the 'Unsubscribe from this mailing' and 'Opt out of all mailings' for anonymous users?
It gives this error message "Missing input parameters" even on the CiviCRM community news letter https://civicrm.org/civicrm/mailing/view?reset=1&id=450
« Last Edit: February 19, 2014, 05:46:40 am by kennedy »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Can't see public mailings if not logged in
February 19, 2014, 06:36:32 am

can u'll reproduce this on demo which should be running 4.4.4

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Can't see public mailings if not logged in
February 19, 2014, 07:20:06 am

Ideally for anon users we should strip out most of the tokens that dont make sense.

This can potentially be done in the mailing view renderer.

Kirk or kennedy: can u'll investigate and submit a patch for this please. We can help u'll get started on IRC

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 19, 2014, 07:45:03 am
Lobo,

I already tried to reproduce this error on drupal.demo.civicrm.org but could not because on that environment, anonymous users do not have permission to "view public CiviMail content" and I can't grant that permission because the demo user doesn't have permission to "Administer permissions" (in Drupal).

Also, the demo environment now seems to be running 4.4.5, not 4.4.4, which may or may not make a difference.

I'm up against tight project deadlines and can't investigate the cause or develop a patch for this one atm. Happy to raise an issue on Jira though, as soon as we're confident that this is a bug in 4.4.4.
« Last Edit: February 19, 2014, 07:50:19 am by kirk »

Kirk

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 2
  • CiviCRM version: 4.5.8
  • CMS version: Drupal 7.39
  • MySQL version: 5.5.44
  • PHP version: 5.6.13
Re: Can't see public mailings if not logged in
February 19, 2014, 08:27:58 am
OK, I just tested this using the CiviCRM 4.4.3 codebase and found that it was possible to view a public mailing when logged out. This confirms that the error was introduced in 4.4.4. I am now going to raise it as a major bug in the issue tracker.

UPDATE: Done. See CRM-14249.
« Last Edit: February 19, 2014, 08:46:40 am by kirk »

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Can't see public mailings if not logged in

This forum was archived on 2017-11-26.