0 votes
ago in SoSci Survey (English) by s314966 (135 points)

Hello,

I am working on a questionnaire with multiple languages and need to send automated emails using the mailSend() function. I would like the email to be sent in the same language as the questionnaire the respondent is currently taking.

Here is my current PHP code:

$voucher = readGET('voucher_code', true);

if (trim($email) !== '' && trim($voucher) !== '') {
    mailSend($email, 2, 0, $voucher);
}

My question: Is there a way to specify the language when using mailSend(), so that the email is automatically sent in the respondent's current questionnaire language?

I have looked at the documentation for mailSend() but couldn’t find a clear indication of how to handle multilingual emails dynamically based on getLanguage(). I would like to avoid having to create separate email templates for each language.

For context, I have already set up the language in the contact file, and respondents receive the invitation email in the correct language.

Thanks a lot

1 Answer

0 votes
ago by SoSci Survey (358k points)

sendMail() will not automatically include any URL in the mailing. Therefore, you'll have to add the URL manually in the mail.

You can just add the parameter l (lower case L) to the URL to specify the language, and add the code from languageCode(). This one would replace the %link% placeholder.

mailSend($email, $mailID, 0, 'https://www.soscisurvey.de/EXAMPLE/?l='.getLanguage());

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...