[xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Ryszard Łach
Hi.

I have a problem with sender address. I have the following configuration:

1. logged in user with email address defined in edit-objects
2. SendPageByEmail from default-1.8.xar with code

#set($sender = $context.user.substring(6))

When I try to send an email the sender is being set to 'XWiki.rlach'.

What else can I check?

R.

-- 
First they ignore you. Then they laugh at you. Then they
fight you. Then you win. - Mohandas Gandhi.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Guillaume Lerouge
Hi Ryszard,

On Thu, Apr 2, 2009 at 1:09 PM, Ryszard Łach ryl...@gmail.com wrote:

 Hi.

 I have a problem with sender address. I have the following configuration:

 1. logged in user with email address defined in edit-objects
 2. SendPageByEmail from default-1.8.xar with code

 #set($sender = $context.user.substring(6))

 When I try to send an email the sender is being set to 'XWiki.rlach'.

 What else can I check?


Are you in a XWiki Enterprise Manager instance? In this case $context.user
would be something like xwiki:XWiki.rlach which means only the first 6 chars
would be trimmed, resulting in XWiki.rlach to be displayed.
What does $context.user returns on your page?
Guillaume

 R.

 --
 First they ignore you. Then they laugh at you. Then they
 fight you. Then you win. - Mohandas Gandhi.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://guillaumelerouge.com/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Ryszard Łach
W dniu 2 kwietnia 2009 13:53 użytkownik Guillaume Lerouge 
guilla...@xwiki.com napisał:

  What elsecan I check?


 Are you in a XWiki Enterprise Manager instance? In this case $context.user
 would be something like xwiki:XWiki.rlach which means only the first 6
 chars
 would be trimmed, resulting in XWiki.rlach to be displayed.
 What does $context.user returns on your page?
 Guillaume


xwiki:XWiki.rlach

I've tried to trim 12 chars, but it also does not change my login name to
email:


com.sun.mail.smtp.SMTPSendFailedException: 501 rlach: sender address must
contain a domain

R.

-- 
First they ignore you. Then they laugh at you. Then they
fight you. Then you win. - Mohandas Gandhi.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Guillaume Lerouge
Hi Richard,

2009/4/2 Ryszard Łach ryl...@gmail.com

 W dniu 2 kwietnia 2009 13:53 użytkownik Guillaume Lerouge 
 guilla...@xwiki.com napisał:

   What elsecan I check?
 
 
  Are you in a XWiki Enterprise Manager instance? In this case
 $context.user
  would be something like xwiki:XWiki.rlach which means only the first 6
  chars
  would be trimmed, resulting in XWiki.rlach to be displayed.
  What does $context.user returns on your page?
  Guillaume
 

 xwiki:XWiki.rlach

 I've tried to trim 12 chars, but it also does not change my login name to
 email:


 com.sun.mail.smtp.SMTPSendFailedException: 501 rlach: sender address must
 contain a domain

Try with:
set($sender =
${context.user.substring(12)}...@${request.servername.substring(4)})
Here I've put 4 as I assumed your domain name would be www.something.com
If your domain name is somethingelse.something.com you'll need to change 4
to 14 (the number of chars in somethingelse + the .)
Hope this helps,
Guillaume




 R.

 --
 First they ignore you. Then they laugh at you. Then they
 fight you. Then you win. - Mohandas Gandhi.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://guillaumelerouge.com/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Ryszard Łach
W dniu 2 kwietnia 2009 14:27 użytkownik Guillaume Lerouge 
guilla...@xwiki.com napisał:


 Try with:
 set($sender =
 ${context.user.substring(12)}...@${request.servername.substring(4)})
 Here I've put 4 as I assumed your domain name would be www.something.com
 If your domain name is somethingelse.something.com you'll need to change
 4
 to 14 (the number of chars in somethingelse + the .)
 Hope this helps,
 Guillaume


Well, I'm sure something like that should work, but I don't think it should
be resolved this way. I have e-mail addresses in Active Directory, my xwiki
users are being autocreated at first login (with LDAP authorization), they
have email field in xwiki filled in so I'll find out how to use it.

Thanks for your help,

R.

-- 
First they ignore you. Then they laugh at you. Then they
fight you. Then you win. - Mohandas Gandhi.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Sender in SendPageByEmail

2009-04-02 Thread Guillaume Lerouge
Hi,

2009/4/2 Ryszard Łach ryl...@gmail.com

 W dniu 2 kwietnia 2009 14:27 użytkownik Guillaume Lerouge 
 guilla...@xwiki.com napisał:

 
  Try with:
  set($sender =
  ${context.user.substring(12)}...@${request.servername.substring(4)})
  Here I've put 4 as I assumed your domain name would be 
 www.something.com
  If your domain name is somethingelse.something.com you'll need to
 change
  4
  to 14 (the number of chars in somethingelse + the .)
  Hope this helps,
  Guillaume
 

 Well, I'm sure something like that should work, but I don't think it should
 be resolved this way. I have e-mail addresses in Active Directory, my xwiki
 users are being autocreated at first login (with LDAP authorization), they
 have email field in xwiki filled in so I'll find out how to use it.

 Thanks for your help,

 R.

Well, then it's pretty easy:
#set($senderdoc = $xwiki.getDocument($context.user))
#set($senderobject = $senderdoc.getObject(XWiki.XWikiUsers))
#set($emailfield = $senderobject.getProperty(email))
#set($senderemail = $emailfield.value)
#set($sender = $senderemail)
Guillaume


 --
 First they ignore you. Then they laugh at you. Then they
 fight you. Then you win. - Mohandas Gandhi.
 ___
 users mailing list
 users@xwiki.org
 http://lists.xwiki.org/mailman/listinfo/users




-- 
Guillaume Lerouge
Product Manager - XWiki
Skype ID : wikibc
http://guillaumelerouge.com/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users