diff --git a/states/maildb/templates/maildb.py b/states/maildb/templates/maildb.py index ec0485c..d091e4f 100644 --- a/states/maildb/templates/maildb.py +++ b/states/maildb/templates/maildb.py @@ -50,7 +50,8 @@ def CreateDB(conn, cursor): def InsertMail(conn, cursor, sender, recipient, content): try: - cursor.execute(f"INSERT INTO mail (sender, recipient, content) values ('{sender}','{recipient}','{content}');") + cursor.execute("PREPARE InsertMail as INSERT INTO mail (sender, recipient, content) values ($1, $2, $3);") + cursor.execute("EXECUTE InsertMail (%s, %s, %s);", (sender, recipient, content)) conn.commit() except Exception as e: print(e)