Skip to content

Parsing AUTH commands #6

@MikeAleksa

Description

@MikeAleksa

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 = "test@nothing.test"
recipient = "test@nothing.test"

# 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!")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions