some problems with SendPageByEmail Application

11 messages Options Options
Embed this Post
Permalink
rrodrigueznt

some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Hi,

I am afraid this is mainly addressed to Guillaume :-(

I've downloaded the application, imported it, configured a SMTP server
and saved the panel as admin. Admin itself can send pages without a
glitch -great feature!- but whoever user I try fails but Admin. Admin
was the only user just with first name. No last name.

I've tried by creating other dummy user without last name and it can
send pages without any problem.

Please, could you figure out how to pass $sender to the mailSenderPlugin
to allow blanks in the string? Am I missing any other point?

Here the head of the error logged. Please, let me know if I could be of
any help by doing some test here.

*****
2008-03-31 00:04:38,625
[http://xpescaderias.environmentalchange.net/xwiki/bin/view/Main/Novidades?sendbyemail=1]
[http-193.144.34.240-80-3] ERROR mailsender.MailSenderPlugin     -
Detailed email informationFrom: Ricardo Rodr?guez
To: webmaster@...
Cc: null
Bcc: null
Subject:Page : Novidades
Text:       <h2 class="heading-1-1-1">Novidades <a
href="$xwiki.getURL("Main.BlogRss", "view", "xpage=rdf")" style=""><img
src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2>
      #set($nbstart = $request.nbstart)
      #set($category = "")
      #set($nbitems = "5")
      #includeMacros("Blog.Macros")

 
HTML:
Author : Ricardo Rodr?guez | Date : Dec 24, 2007 00:18 | Email comment :
      <h2 class="heading-1-1-1">Novidades <a
href="/xwiki/bin/view/Main/BlogRss?xpage=rdf" style=""><img
src="/xwiki/skins/albatross/icons/black%2Drss.png" alt="rss icon"/></a></h2>
            <p/>
<div class="hfeed">
</div> <p/>

 
2008-03-31 00:04:38,626
[http://xpescaderias.environmentalchange.net/xwiki/bin/view/Main/Novidades?sendbyemail=1]
[http-193.144.34.240-80-3] ERROR mailsender.MailSenderPlugin     -
sendHtmlMessage
javax.mail.internet.AddressException: Illegal whitespace in address in
string ``Ricardo Rodr?guez''
    at
javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:926)
    at javax.mail.internet.InternetAddress.parse(InternetAddress.java:819)
    at javax.mail.internet.InternetAddress.parse(InternetAddress.java:555)
    at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:91)
*****

Thanks!!

Ricardo

--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Hi Ricardo,

I've downloaded the application, imported it, configured a SMTP server

> and saved the panel as admin. Admin itself can send pages without a
> glitch -great feature!- but whoever user I try fails but Admin. Admin
> was the only user just with first name. No last name.
>
> I've tried by creating other dummy user without last name and it can
> send pages without any problem.
>
> Please, could you figure out how to pass $sender to the mailSenderPlugin
> to allow blanks in the string? Am I missing any other point?
>

Thanks for pointing the problem out. Till I come up with a better solution,
you can do the following :

Replace #set($sender = $xwiki.getUserName($context.user, false)) with
#set($sender = $context.user.substring(6)) .

It will look less good as you'll get "UserName" instead of "User Name" but
at least it should work. I guess it's written somewhere in the SMTP spec
that email addresses shall not have spaces within them :-)

I'll update the XAR on XWiki.org accordingly.

Guillaume
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
rrodrigueznt

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Thanks Guillaume,

Guillaume Lerouge wrote:

> Thanks for pointing the problem out. Till I come up with a better solution,
> you can do the following :
>
> Replace #set($sender = $xwiki.getUserName($context.user, false)) with
> #set($sender = $context.user.substring(6)) .
>
> It will look less good as you'll get "UserName" instead of "User Name" but
> at least it should work. I guess it's written somewhere in the SMTP spec
> that email addresses shall not have spaces within them :-)
>
> I'll update the XAR on XWiki.org accordingly.
>
> Guillaume
>  

Done. It now works fine. Could it perhaps be suitable to include the
sender email address for registered users and the Admin email for guest?

Cheers,

Ricardo

--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Re,


> Done. It now works fine. Could it perhaps be suitable to include the
> sender email address for registered users and the Admin email for guest?


Right now guests are presented with "you need to be logged in to use this
feature" message bcoz I was afraid of spam thru too many people clicking
just to see what happens.

You can do it though :

   1. remove the "#if($context.user == 'XWiki.XWikiGuest')" check and its
   related "#end"
   2. replace the $sender line with : #if($context.user == '
   XWiki.XWikiGuest') #set($sender = 'guest') #else #set($sender =
   $context.user.substring(6)) #end

Guillaume
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
rrodrigueznt

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Guillaume Lerouge wrote:

> Right now guests are presented with "you need to be logged in to use this
> feature" message bcoz I was afraid of spam thru too many people clicking
> just to see what happens.
>
> You can do it though :
>
>    1. remove the "#if($context.user == 'XWiki.XWikiGuest')" check and its
>    related "#end"
>    2. replace the $sender line with : #if($context.user == '
>    XWiki.XWikiGuest') #set($sender = 'guest') #else #set($sender =
>    $context.user.substring(6)) #end

Oops! I've just tried with guest without doing this change and it
allowed me to send messages... :-(
Could you figure out why? From field: XWikiGuest.

I'm sending you the received message.

Greetings,

Ricardo

--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
>
> Oops! I've just tried with guest without doing this change and it
> allowed me to send messages... :-(
> Could you figure out why? From field: XWikiGuest.


Fixed ;-)

http://code.xwiki.org/xwiki/bin/download/Applications/SendPageByEmailApplicationDownloads/Panels.SendPageByEmail3.xar

Guillaume
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
rrodrigueznt

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Thanks!

Guillaume Lerouge wrote:

>> Oops! I've just tried with guest without doing this change and it
>> allowed me to send messages... :-(
>> Could you figure out why? From field: XWikiGuest.
>>    
>
>
> Fixed ;-)
>
> http://code.xwiki.org/xwiki/bin/download/Applications/SendPageByEmailApplicationDownloads/Panels.SendPageByEmail3.xar
>
> Guillaume

Up and running!

Please, take a look to this error:

Author : Ricardo Rodríguez | Date : Mar 24, 2008 02:43 | Email comment :
Error number 4001 in 4: Error while parsing velocity page
Main.VideoPromocional Wrapped Exception: Invocation of method
'sendRedirect' in class com.xpn.xwiki.web.XWikiServletResponse threw
exception java.lang.IllegalStateException @ Main.VideoPromocional
<mailbox:///Users/rrodriguez/Library/Thunderbird/Profiles/wm2vak20.default/Mail/mire.environmentalchange.net/InEPEC?number=81396775>2,11?
</xwiki/bin/edit/Main/2%2C11?parent=Main.VideoPromocional>

It is generated while sending pages with Velocity code. For instance, if
I send the home page with the snippet you have proposed to force a given
skin to be used in a page...

#if("$!request.skin" != "XWiki.SkinPescaderiasHome")
$response.sendRedirect($doc.getURL("view",
"skin=XWiki.SkinPescaderiasHome"))
#end

Any Velocity statement I've tried with generates the same error.

Perhaps if must be avoided to send Velocity code and send instead a
warning or something like that. Just an idea. It seems that
$doc.getRenderedContent() doesn't like this Velocity stuff. Please, do
you know how this error could be avoided? I am planning to use it a site
where we many pages uses the code snippet you proposed and other
Velocity statements.

Thanks for your work!

Ricardo


--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Hi Ricardo,


> Any Velocity statement I've tried with generates the same error.
>
> Perhaps if must be avoided to send Velocity code and send instead a
> warning or something like that. Just an idea. It seems that
> $doc.getRenderedContent() doesn't like this Velocity stuff. Please, do
> you know how this error could be avoided? I am planning to use it a site
> where we many pages uses the code snippet you proposed and other
> Velocity statements.


2 choices I think :

   1. Remove the script from the pages, put them in other pages and use
   #includeTopic('Other.Page')
   2. Replace getRenderedContent() with getContent() (u'll have
   text-onlye pages showing up with wiki markup but at least they won't break)

Guillaume
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
rrodrigueznt

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Thanks!

Guillaume Lerouge wrote:
> 2 choices I think :
>
>    1. Remove the script from the pages, put them in other pages and use
>    #includeTopic('Other.Page')
>    2. Replace getRenderedContent() with getContent() (u'll have
>    text-onlye pages showing up with wiki markup but at least they won't break)
>
> Guillaume

First works fine with "other" Velocity, but not for pages including the
"force skin" trick as it get redirected to the page holding the snippet.

I think this is a very particular side effect of a previous trick, so I
am not sure if I must waste your time here considering much better
methods to manage backgrounds and other layout characteristics are on
their way. In the meantime, the second method will do perfectly here.
Thanks!

One curious thing: by using getContent() I didn't get any result
message: no success, no failure. Could you figure out why? Thanks!

Cheers,

Ricardo

--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
Guillaume Lerouge

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
>
> > Guillaume
>
> First works fine with "other" Velocity, but not for pages including the
> "force skin" trick as it get redirected to the page holding the snippet.


Use #includeInContext('Other.Page') instead.


> I think this is a very particular side effect of a previous trick, so I
> am not sure if I must waste your time here considering much better
> methods to manage backgrounds and other layout characteristics are on
> their way. In the meantime, the second method will do perfectly here.
> Thanks!
>
> One curious thing: by using getContent() I didn't get any result
> message: no success, no failure. Could you figure out why? Thanks!
>

That's weird. Did you change anything else than

#set($emailcontent = "
Author : $xwiki.getUserName($doc.getContentAuthor(), false) | Date :
$xwiki.formatDate($doc.date, 'MMM dd, yyyy HH:mm') | Email comment :
$emailcomment
$doc.getContent()
$emailpagecomments
")

?

Guillaume
_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users
rrodrigueznt

Re: some problems with SendPageByEmail Application

Reply Threaded More More options
Print post
Permalink
Hi!

Guillaume Lerouge wrote:
>>> Guillaume
>>>      
>> First works fine with "other" Velocity, but not for pages including the
>> "force skin" trick as it get redirected to the page holding the snippet.
>>    
>
>
> Use #includeInContext('Other.Page') instead.
>  


Works fine for getting the page included, but SendPageByMail send
corrrectly the page but adding the following error

Error number 4001 in 4: Error while parsing velocity page Main.Donde
Wrapped Exception: Invocation of method 'sendRedirect' in class
com.xpn.xwiki.web.XWikiServletResponse threw exception
java.lang.IllegalStateException @ Main.Donde
<mailbox:///Users/rrodriguez/Library/Thunderbird/Profiles/wm2vak20.default/Mail/mire.environmentalchange.net/InEPEC?number=81591871>3,11?
</xwiki/bin/edit/Main/3%2C11?parent=Main.Donde>

No success or failure message in the panel even though the message has
been sent.

>> That's weird. Did you change anything else than
>>
>> #set($emailcontent = "
>> Author : $xwiki.getUserName($doc.getContentAuthor(), false) | Date :
>> $xwiki.formatDate($doc.date, 'MMM dd, yyyy HH:mm') | Email comment :
>> $emailcomment
>> $doc.getContent()
>> $emailpagecomments
>> ")
>>
>> ?
>>    

I've done again this changes and it works fine: success or failure
message whatever method, $doc.getContent() or $doc.getRenderedContent()
, I use. I don't know where I was wrong. Sorry for the noise.

All the best,

Ricardo

--
Ricardo Rodríguez
Your EPEC Network ICT Team

_______________________________________________
users mailing list
users@...
http://lists.xwiki.org/mailman/listinfo/users