'Loop in pywhatkit is not working in python while sending the whatsapp message

In below code 21 is hour and 53 is min and 10 is wait time in this code I want to send message in loop frequently but I failed. I also tried for loop but it is not working. Any body know how to send 100 message in whatsapp using python please help me

import pywhatkit
from flask import Flask
while 1:
  pywhatkit.sendwhatmsg("+9198xxxxxxxx", "Hi",21,53,10)


Solution 1:[1]

look, first of all, pywhatkit does not send a message automatically, it just types the message and opens the DM of that person and we have to press enter to send, so to do this, you would have to press enter a 100 times too. Secondly, You cant do this because using sendwhatmsg_instantly(), the message goes on the spot and using only the sendwhatmsg() method requires a section for time and every time the login time is different and you cant determine that, so instead of whatsapping a message to someone 100 times, send an email instead using smtplib--

import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login(youremailid, yourgmailpassword)      
server.sendmail(youremailid, to, content)
server.close()
#you can perform this in a For loop

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman