-
Notifications
You must be signed in to change notification settings - Fork 305
Sending a Mail
send_mail(email_sender: str, password: str, subject: str, message: str | MIMEText, email_receiver: str) -> None
This function is used to send emails. We use regex to determine the email provider using the domain in the email address and the SMTP hostname is set automatically according to the provider. The SMTP hostname is the location of the SMTP server for the email service you are using. Here is a list of the SMTP hostnames for some common email services.
Example: pywhatkit.send_mail("test@test.com", "password", "Test Mail", "This is a test email", "testrecv@test.com")
The password here is the App Password that you can get from your Email Account Settings. There are various guides online on how to setup these. We recommend you to store the message in a variable if it is a long message so that the code remains readable.
Please make sure the Credentials you have entered are correct and never share you app password with anyone!
send_hmail(email_sender: str, password: str, subject: str, html_code: str, email_receiver: str) -> None
This function can be used to send emails with HTML Code as body content. It uses the send_mail
function to send the email.
Example: pywhatkit.send_hmail("test@test.com", "password", "test", "<h1>HELLO</h1>", "receive@test.com")
PyWhatKit Version 5.2