Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

send email based on answers

More
5 years 3 months 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
The topic has been locked.
More
5 years 3 months 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
The topic has been locked.
More
5 years 3 months 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: www.limesurvey.org/manual/Expression_Man...code_Variable_Naming


Thank you
The topic has been locked.
More
5 years 3 months 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 :)

Manual: manual.limesurvey.org/LimeSurvey_Manual
Bugs tracker: bugs.limesurvey.org/my_view_page.php
If you self-host and need help, contact one of our partners: limesurvey.com
Please do not contact me via PM - thank you.
The topic has been locked.
More
5 years 3 months ago #199884 by Joffm
Replied by Joffm on topic send email based on answers
Hi,
see here:
www.limesurvey.org/manual/ExpressionScri..._in_invitation_email
and
www.limesurvey.org/manual/ExpressionScri...#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
The topic has been locked.
More
5 years 3 months 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.29 KB
The topic has been locked.
More
5 years 3 months ago - 5 years 3 months 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: 5 years 3 months ago by Joffm.
The topic has been locked.
More
5 years 3 months 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>
The topic has been locked.
More
5 years 3 months 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.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
5 years 3 months 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
The topic has been locked.
More
5 years 3 months 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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
5 years 3 months 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

The topic has been locked.
More
5 years 3 months 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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
5 years 3 months 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.
The topic has been locked.
More
5 years 3 months ago - 5 years 3 months 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 support - Plugins, theme and development .
I don't answer to private message.
Last edit: 5 years 3 months ago by DenisChenu.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose