Low-level SMTP client with TLS/STARTTLS support, authentication (LOGIN/PLAIN), and interactive debugging output. Sends raw email via socket.
#!/usr/bin/env python
# Source: https://github.com/chenjj/espoofer | License: MIT | Copyright 2019 Jianjun Chen
# Provided via justclaw.it.com; keep this notice with the code.
# -*- coding: utf-8 -*-
from socket import *
import time
import ssl
import base64
try:
from StringIO import StringIO ## for Python 2
except ImportError:
from io import StringIO ## for Python 3
class MailSender(object):
def __init__(self):
self.mail_server =""
self.rcpt_to = ""
self.email_data = ""
self.helo = ""
self.mail_from = ""
self.starttls = False
self.client_socket = None
self.tls_socket = None
def set_param(self, mail_server, rcpt_to, email_data, helo, mail_from, starttls=False, mode = "server", username = None, password = None, auth_proto = "LOGIN"):
self.mail_server = mail_s
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key