Of course I modify shareinline.vm to use 
xwiki.getXWikiPreference('admin_email') value.

But I think your test must be:
is there a valid admin_email configured? (regexp to verify the mail format)
├ yes: use the admin_email
└ no :is the server name an IP?
  └ yes: use a generic nodomain.net
  └ no:  use the actual domain name

... but it is my advice :-)

Thxs for yours answers.


________________________________
 De : Sergiu Dumitriu <ser...@xwiki.org>
À : users@xwiki.org 
Envoyé le : Mardi 4 mars 2014 19h27
Objet : Re: [xwiki-users] Wrong regexp in sendmail function?
 

[...] is how IPv6 IPs are written. So the regexp detects if the hostname
is an IPv4 or an IPv6 raw IP.

The current logic is:

is the server name an IP?
├ yes: is there a valid admin_email configured?
│ ├ yes: use the admin_email
│ └ no: use a generic nodomain.net
└ no: use the actual domain name

What you want:
- always use the configured admin_email

The only way to do that is to change the shareinline.vm template (see
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Skins for details
about how to properly override a template) and change the order of the
conditions.

On 03/04/2014 11:26 AM, Guillaume Fenollar wrote:
> Hello Pascal.
> From what I understand, this regex validates either:
> 
>    - A server name with brackets, so yours would be "[iwiki.cp2i.i2]"
>    - An IP address (4 groups of 1 to 3 digits, dot separated)
> 
> So maybe it will work if you add brackets to your server name? And yes, I
> find it a bit strange, me too. :-)
> 
> Hope it helps,
> 
> 
> Guillaume Fenollar
> 
> 
> 2014-03-04 11:28 GMT+01:00 Pascal BASTIEN <pbasnews-xw...@yahoo.fr>:
> 
>> Hello
>>
>> I think there are a wrong regexp in sendmail function in
>> templates/shareinline.vm (xwiki 5.4.1)
>>
>>
>> #if ($serverName.matches('\[.*\]|(\d{1,3}+\.){3}+\d{1,3}+'))
>>     #if ("$!{xwiki.getXWikiPreference('admin_email')}" != '')
>>       #set ($sender = "$!{escapetool.q($sender)}
>> <$!{xwiki.getXWikiPreference('admin_email')}>")
>>     #else
>>       #set ($sender = "$!{escapetool.q($sender)} <nore...@domain.net>")
>>     #end
>>   #else
>>     #set ($sender = "$!{escapetool.q($sender)} <noreply@$!{serverName}>")
>>   #end
>>
>> I filled admin_email and my my nameserver is "iwiki.cp2i.i2" but i tried
>> with "iwiki.cp2i.fr" to.
>>
>> I don't understand very well the regexp (writing a regexp is simpler to
>> read it) but when I send a mail with xwiki I felt in "#set ($sender =
>> "$!{escapetool.q($sender)} <noreply@$!{serverName}>")" condition...


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to