<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Email_python_2</id>
	<title>Email python 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Email_python_2"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Email_python_2&amp;action=history"/>
	<updated>2026-04-24T19:04:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Email_python_2&amp;diff=5180&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;``` import smtplib from email.mime.text import MIMEText  SMTP_SERVER = 'localhost'  # SMTP server address (echo server running on localhost) SMTP_PORT = 1025  # Port used by t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Email_python_2&amp;diff=5180&amp;oldid=prev"/>
		<updated>2024-04-08T18:06:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;``` import smtplib from email.mime.text import MIMEText  SMTP_SERVER = &amp;#039;localhost&amp;#039;  # SMTP server address (echo server running on localhost) SMTP_PORT = 1025  # Port used by t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;```&lt;br /&gt;
import smtplib&lt;br /&gt;
from email.mime.text import MIMEText&lt;br /&gt;
&lt;br /&gt;
SMTP_SERVER = 'localhost'  # SMTP server address (echo server running on localhost)&lt;br /&gt;
SMTP_PORT = 1025  # Port used by the SMTP server&lt;br /&gt;
&lt;br /&gt;
FROM = 'sender@example.com'  # Sender's email address&lt;br /&gt;
TO = ['recipient@example.com']  # Recipient's email address(es)&lt;br /&gt;
&lt;br /&gt;
# Create a MIMEText object with the email content&lt;br /&gt;
message = MIMEText('This is the email body.')&lt;br /&gt;
&lt;br /&gt;
# Add sender and recipient email addresses to the MIMEText object&lt;br /&gt;
message['From'] = FROM&lt;br /&gt;
message['To'] = ', '.join(TO)&lt;br /&gt;
message['Subject'] = 'Subject of the email'&lt;br /&gt;
&lt;br /&gt;
try:&lt;br /&gt;
    # Connect to the SMTP server&lt;br /&gt;
    server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)&lt;br /&gt;
&lt;br /&gt;
    # Send the email&lt;br /&gt;
    server.sendmail(FROM, TO, message.as_string())&lt;br /&gt;
    print(&amp;quot;Email sent successfully!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
except Exception as e:&lt;br /&gt;
    print(&amp;quot;Failed to send email:&amp;quot;, e)&lt;br /&gt;
&lt;br /&gt;
finally:&lt;br /&gt;
    # Check if server is defined before trying to quit it&lt;br /&gt;
    if 'server' in locals():&lt;br /&gt;
        server.quit()&lt;br /&gt;
&lt;br /&gt;
```&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>