You can use Google's SMTP server to send email messages using the Simple Mail Transfer Protocol (SMTP). Here is an example of how to use the smtplib library in Python to send an email using Google's SMTP server:

import smtplib  
# create an SMTP object 
server = smtplib.SMTP('smtp.gmail.com', 587)  
# start the server connection server.starttls()  
# login to the server using your email and password server.login("your_email@gmail.com", "your_password"
 # create the message 
from_address = "your_email@gmail.com" 
to_address = "recipient_email@example.com" 
subject = "Test email from Python" 
body = "This is a test email sent from Python using Google's SMTP server." message = f"Subject: {subject}\n\n{body}"  
# send the message 
server.sendmail(from_address, to_address, message) 
 # close the server connection 
server.quit()

In this example, "your_email@gmail.com" and "your_password" should be replaced with your actual Google email address and password. Also "recipient_email@example.com" should be replaced with the email address of the recipient.

Please note that if you are using 2-factor authentication then you need to use application-specific password.

أحدث أقدم