Under Policy > emailtext related queries

Hi,
I had a couple of question on the Policy> Emailtext point.

  • Is there a way where we can use the Usename/ Firstname/ Lastname fetched from the httpresolver? I tried {username}, {surname} and {userrealm} but didn’t help.
  • emailtext > If not used an Email html format, and tried using and message as a string, then
  1. what is max length for emailtext?
  2. using {otp} as the value, the email sending is failed, where as if used “<“otp”>” then email is sent successfully.
  3. if wanted to use “<“username”>” or {username} then the value is not printed as it is in the mail body.
    image

It is not clear what you want to achieve.

  1. Wanted to know how we can use the username received from httpsresolver in the email html template, Tried using {username}, {surname} and {userrealm} but didn’t help.

  2. Using emailtext string message.

  • tried {otp} in the string for emailtext policy it was failing to send email due to {otp}.
  • also the {username}/’<‘username’>’ tag is not replaced with the value if entered in the form of string under emailtext policy

In the email token?
According to thsi? 7.3. Authentication policies — privacyIDEA 3.6.2 documentation

You need to set a policy to add the user details in the response!

Whatever this means.

Hi @cornelinux
In the Email Token Mail Format,
defined the Email.txt file with path in the emailtext action under policy,
file:/opt/privacyidea/venv/etc/privacyidea/email.txt
here the value for {username} is the Token owners username,
so wanted to know, how can I get the value of username from the httpresolver which is called during the email token trigger challenge and that value can be assigned to the Email Body ?

Email.txt content is as mentioned below.

</head>
<body>
	**<p>Hi {username}**
		<br/>
		<br/>Your OTP for login is : <b><i>{otp}</i></b>
		<br/>serial number : {serial}
		<br/>
		<br/>The OTP will be expired in 120 secs
		<br/>
		<br/>Your Admin
		<br/><b>ABC</b>
	</p>
</body>

httpresolver response.

{
  "Username": "Melwin 1",
  "email": "Melwin.dsouza@test.com",
  "mobile": "0000000001"
}

Thank you for the help.