Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Help! Validation.eml template problem!

Quote Reply
Help! Validation.eml template problem!
I tried to use the following complex email header to make subject different conditions which depend on admin options.

The require_signup_email_validation is set to: Yes No
The require_signup_admin_validation is set to: Yes No

Code:
To: <%user_email%>
<%if require_signup_email_validation and require_signup_admin_validation%>
Subject: <%site_home%> - Validation 1st step: Email validate
<%elsif require_signup_email_validation%>
Subject: <%site_home%> - Only Email validate
<%elsif require_signup_admin_validation%>
Subject: <%site_home%> - Only admin validate
<%else%>
Subject: <%site_home%> - Successful registration
<%endif%>
From: <%site_home%> <<%admin_email%>>

But when I try to register, the result Subject is badly:
Subject: <%site_home%> - Successful registration
Crazy

The good result should be:
Subject: <%site_home%> - Validation 1st step: Email validate

Any idea, what can be the problem?
Please Unimpressed

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Well if it is yes/no you need ... eq 'Yes' Smile
Quote Reply
Re: [Paul] Help! Validation.eml template problem! In reply to
I don't think so, because in the Data.pm is stored like this:
'require_signup_admin_validation' => '1',
'require_signup_email_validation' => '1',

Otherwise <%if require_signup_email_validation%> is good enough to find if it is true or not.

No, I'm afraid this is not the answer for the problem Frown

I can not imagine what can be the problem.
It seems good syntactically...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Well you did say it was yes/no ...I can only work with the info you give me Angelic

Try printing those tags to see if they have the values you expect ...ie 1 or 0
Quote Reply
Re: [Paul] Help! Validation.eml template problem! In reply to
Of course both shows:
1
1

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Just out of interest try:

<%if require_signup_email_validation == '1' and require_signup_admin_validation == '1'%>
Quote Reply
Re: [Paul] Help! Validation.eml template problem! In reply to
No. Still the same problem.
I think this must be a bug.

Once I mistyped something and I got something interesting:
Code:
<%Else%>Subject: Successful registration

<%Elsif Require_signup_admin_validation%>Subject: Only admin validate
<%Elsif Require_signup_email_validation%>Subject: Only Email validate
<%If Require_signup_email_validation And Require_signup_admin_validation%>

Do you see the capital First letters?
In the e-mail, appeard as above, with capital First letters.
I think this makes the problem...

Alex may able to help to find out what is happening...
If this is a bug I can not correct it.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 10, 2002, 11:02 AM
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
What happened when you used Else ?
Quote Reply
Re: [Paul] Help! Validation.eml template problem! In reply to
Above is the result.
I did about 20-30 test registrations, so I don't know which one caused the interesting result above.
I modified the if conditions in many ways to find out the problem.
One resulted the result above.

Is it possible that the e-mail header is parsed differently or first?
This may changed tags to capitals, then the template parser was not able to parse correctly?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 10, 2002, 11:13 AM
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Found it! Cool

Seems email header was parsed first.
Subject: is not allowed multiple times in the header. Only last one was inserted.

Good solution:
Code:
To: <%user_email%>
Subject: <%if require_signup_email_validation and require_signup_admin_validation%>
<%site_home%> - Validation 1st step: Email validate
<%elsif require_signup_email_validation%>
<%site_home%> - Only Email validate
<%elsif require_signup_admin_validation%>
<%site_home%> - Only admin validate
<%else%>
<%site_home%> - Successful registration
<%endif%>
From: <%site_home%> <<%admin_email%>>

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Hi,

Also, be careful with linefeeds, your first blank line indicates the end of the message header. Your first method would insert two blanks lines after the To: header which is what was causing the problem:

To: ..\n
<%if ..%>\n
Subject
..
<%endif%>\n

Would end up like:

To: ...

Subject: ..
From: ..

See the problem?

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Help! Validation.eml template problem! In reply to
Alex, yep, I see the problem.

BTW: If a template line has only tags in it, like <%if ...%> etc, and the result it leaves a blank line after the template parsing.
This makes very messy result html pages with much air in it... Frown
So while the template code is readable easily, the parsed html pages are very unreadable, which makes debugging more difficult.

So would be possible to correct the template parser, if there was a line only with tags and spaces and nothing else, then delete the blank result line?
Something like e.g.:
$text =~ s/\s*<%.*%>\s*\n//mgi;

This bug disturbs me since Links 2.0, and I think it should be corrected.
Would be possible?
This would help us avoiding such problems I had.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Help! Validation.eml template problem! In reply to
Watch out here - the e-mail templates are broken up into header lines first. Each header has to be on one line. For example:

Subject: <%if foo%>Foo<%elsif bar%>Bar<%else%>Neither foo nor bar<%endif%>
From: <%email%>

Note that the subject value has to be all on the same line.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Help! Validation.eml template problem! In reply to
Jagerman,

Yes, I understood that.
In my previous post I was talking only about the source of the problem, which was caused by the template parser.

I contacted Alex and we are investigating the problem.
Thanks for you clear explanation!

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...