$def with (user, book, waitinglist_record) $var subject: $book.title is available to borrow $ expiry = waitinglist_record.get('expiry') $ expiry_text = ' (before %s UTC)' % expiry if expiry else '' Hello $user.displayname, Congratulations! The book "$book.title", which you have been waiting to borrow from Open Library, is now available. We've put the book on hold for you as you are the next person on the waiting list. Please visit the following link to borrow the book. $book.url("/borrow", relative=False) You'll have to borrow the book within 24 hours from now$expiry_text, or else the book will be passed to the next person on the waiting list. Thank you for using Open Library. Sincerely, The Open Library Team https://openlibrary.org/