How to send individual emails customized in HTML with tokens assigned to each recipient based on one search every 24 hours to warn of password expiry?



I know that there have been previous threads where users have had similar problems, however, I am looking at how to send emails to alert users based on a specific criteria. I cannot access the script so cannot modify that. It would be great if there was an alternative solution.

For example, I have a table with users, emails and password expiry details. I want to send a custom email(html design) to all the users that have their password expiring in 2 days.

The query so far looks something like this:
index=example sourcetype=example source=example
| search PasswordExpiryDate="2"
| eventstats values(mail) AS mailadresses
| eval recipients=mvjoin(mail
adresses, ",")
| table user, PasswordExpiryDate, mail, FirstName, Domain
| sendemail to="" bcc=$result.recipients$ subject="Reminder- Windows Password Expiration" message="
Hello $result.FirstName$,

Your $result.Domain$ Windows Desktop password will expire on $result.PasswordExpiryDate$."

I would like to modify this in html and then have each individual result generate a custom email to the user.
At the moment, the custom email for the first result is sent to the entire list, which is what the function is supposed to do in the first place. Is it possible to work around this or does the script need to be modified, if so, does anyone have an example?

Any help would be appreciated, tried to find an answer everywhere but no such luck yet.

Thank you and hope you have an awesome day!


Set this scheduled search an alert.
Set the alert mode to once per result.

Then configure the send email alert action using the tokens.

0 Karma