Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing AUTH commands #6

Open
MikeAleksa opened this issue May 23, 2023 · 2 comments
Open

Parsing AUTH commands #6

MikeAleksa opened this issue May 23, 2023 · 2 comments

Comments

@MikeAleksa
Copy link

Is it possible to parse AUTH commands as well?

For example, sending mail to a local serving using the following command fails because SMTP AUTH extension not supported by server:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

# SMTP server details
smtp_server = "localhost"
smtp_port = 8025

# Sender and recipient details
sender = "[email protected]"
recipient = "[email protected]"

# Create a message object
message = MIMEMultipart()
message["From"] = sender
message["To"] = recipient
message["Subject"] = "Test email"

# Add message content
message.attach(MIMEText("This is a test email.", "plain"))

# Connect to the SMTP server with TLS
smtp_obj = smtplib.SMTP(smtp_server, smtp_port)
smtp_obj.starttls()  # Enable TLS

# Send the email
smtp_obj.login(sender, "some_password") # <--- THIS LINE BREAKS THE SERVER
smtp_obj.sendmail(sender, recipient, message.as_string())

# Disconnect from the server
smtp_obj.quit()

print("Email sent successfully!")
@Tsai002
Copy link

Tsai002 commented May 24, 2023

@MikeAleksa I have a awful version that support AUTH. jothan/smtpbis@efdb1c6

@MikeAleksa
Copy link
Author

Thanks @Tsai002 - was looking at implementing myself so that is a great starting point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants