send email based on answers

More
1 month 2 weeks ago #199828 by srn122
Hello,

I am using Version 3.6.1+180329.

I have a short survey with 4 yes/no questions and an email field.

Is it possbile to send an email to the email address completed by user?

There will be two scenarios:
-in case of all yes answers send an email
-if one or more no answers send a different email.

Thank you

Please Log in to join the conversation.

LimeSurvey Partners
More
1 month 2 weeks ago #199829 by Joffm
Replied by Joffm on topic send email based on answers
Use one of the notification emails.

let's say "Send basic admin notification email to:"
In the email field enter {Q_email} with "Q_email" as code of your email question.

In the email body you use "micro-tayloring" to enter the texts.
E.g.
{if(Q1=="Y" AND Q2=="Y" AND Q3=="Y" AND Q4=="Y","Text of 4 YES answers","Text of 1 or more NO answers")}

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, cdorin, srn122

Please Log in to join the conversation.

More
1 month 2 weeks ago #199871 by srn122
Replied by srn122 on topic send email based on answers
Thank you for your reply,

I have managed to do something but I only receive empty emails.

I tried different ways but same results.

i used question codes(Q1, Q2..), question codes with curly brackets({Q1}, {Q2}..) with answer codes with or without curly brackets(Q1A1, {Q2A1}...) or exact string as you mentioned Q1=="Nu" but always empty emails.

And I dont see what I am doing wrong.

Are there some explanations as to what type of coding I should enter to make it work?

I ve tried looking at this manual section but it didnt help me: manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming


Thank you

Please Log in to join the conversation.

More
1 month 2 weeks ago #199872 by cdorin
Replied by cdorin on topic send email based on answers
Better provide an .lss file to see what you did so far :)

Please Log in to join the conversation.

More
1 month 2 weeks ago #199884 by Joffm
Replied by Joffm on topic send email based on answers
Hi,
see here:
https://manual.limesurvey.org/ExpressionScript_How-tos#.22Dear_.7BMr.7D.2F.7BMrs.7D_Smith....22_in_invitation_email
and
https://manual.limesurvey.org/ExpressionScript_-_Presentation#Access_to_variables

exact string as you mentioned Q1=="Nu"

Nowhere I mentioned this.
{if(Q1=="Y" AND Q2=="Y" AND Q3=="Y" AND Q4=="Y","Text of 4 YES answers","Text of 1 or more NO answers")}

To find out how these predefined question types (Y/N, Gender, array(Yes/No/Unsure),..) are coded, you should activate a small sample survey with these question types, enter some data, and look at the answer table.

But nevertheless: as cdorin: Send your lss export.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
1 month 2 weeks ago #199907 by srn122
Replied by srn122 on topic send email based on answers
here is the lss.

File Attachment:

File Name: limesurvey...1489.lss
File Size:21 KB
Attachments:

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #199908 by Joffm
Replied by Joffm on topic send email based on answers
2. mistakes

1. The syntax of this IF-statement is wrong_
{if({Q3}=="Nu" AND {Q4}=="Nu" AND {Q5}=="Nu" AND {Q6}=="Nu","No Answer text","Yes Answer text")}
Can't you copy what I wrote?

2. You have to compare with CODE of answer option, NOT text of answer option
In your first post you talked about "Yes/No" question.
Therefore this statement compares with the code of a "Yes/No" question.

{if(Q1=="Y" AND Q2=="Y" AND Q3=="Y" AND Q4=="Y","Text of 4 YES answers","Text of 1 or more NO answers")}


But now I see that you use a list radio. So you have to use these codes.
So obviously you have to use:
{if(Q1=="A1" AND Q2=="A1" AND Q3=="A1" AND Q4=="A1","Text of 4 YES answers","Text of 1 or more NO answers")}

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 month 2 weeks ago by Joffm.

Please Log in to join the conversation.

More
1 month 2 weeks ago #199946 by srn122
Replied by srn122 on topic send email based on answers
I ve said I tried all possible combination, including your expression, the one you saw was probably just the last attempt.

Anyway, now it works, thank you.

But I have another issue: Can I add text with html tags inside the email body?

The second email won't be just a phrase.
Now I have something like this on the 'source' tab, and in place of formatted text I receive only blank email:


<html>
<head>
<title></title>
</head>
<body>{if(Q3=="A1" AND Q4=="A1" AND Q5=="A1" AND Q6=="A1","TEXTTEXTTEXT","TEXTTEXTTEXTT
<ul>
<li>OPTION1OPTION1.</li>
<li>OPTION2OPTION2</li>
<li>OPTION3OPTION3.</li>
</ul>
")}</body>
</html>

Please Log in to join the conversation.

More
1 month 2 weeks ago #200019 by holch
Replied by holch on topic send email based on answers

Can I add text with html tags inside the email body?


Yes.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
1 month 2 weeks ago #200025 by srn122
Replied by srn122 on topic send email based on answers
I meant inside the text of the two different emails messages.
As I tried with the unordered list, but it doesnt show.
As I said when I try it only sends blank emails.

I hope I explained it well

Please Log in to join the conversation.

More
1 month 2 weeks ago #200031 by DenisChenu
Mail was set as html ?
Can you reproduce on a sample light lss ?
If yes : report issue

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
1 month 2 weeks ago #200038 by srn122
Replied by srn122 on topic send email based on answers

DenisChenu wrote: Mail was set as html ?


I think it is by default. Where is this option?

Can you reproduce on a sample light lss ?


I uploaded an lss earlier.
Or do you mean something else?

If yes : report issue

Please Log in to join the conversation.

More
1 month 2 weeks ago #200049 by DenisChenu
1. Previous lss is broken …
2. there are issue in quote system.
3. Sample light lss

ligtht : because else : you can open a support ticket …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
1 month 2 weeks ago #200053 by srn122
Replied by srn122 on topic send email based on answers
it should be ok though, some people here already helped me with it.

My limesurvey version is Version 3.6.1, I dont see any sample light lss ...

Maybe I dont understand what you re saying..


Anyway, the issue is with the basic admin notification email:

If I try to use an expression like:

if ("some answer conditions","send this message","else send this message")

In the messages to be sent, I need the text a little bit formatted, but once I try to use html tags, it sends only blank emails.

Please Log in to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #200055 by DenisChenu
The previous less are not up to date.


Else : do the logic in text mode edition

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
Attachments:
Last edit: 1 month 2 weeks ago by DenisChenu.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now