def send_mail(server, from_address, from_name, to_address, subject, body_arg, return_addr, tls):
msg = MIMEMultipart('alternative')
msg['To'] = to_address
msg['Date'] = formatdate(localtime = True)
msg['Subject'] = subject
msg.add_header('reply-to', return_addr)
msg.add_header('from', from_name + "<" + from_address + ">")
part1 = MIMEText(body_arg, 'plain')
part2 = MIMEText(body_arg, 'html')
msg.attach(part1)
msg.attach(part2)
try:
smtp = smtplib.SMTP(server)
smtp.set_debuglevel(VERBOSE)
smtp.sendmail(from_address, to_address, msg.as_string())
smtp.quit()
except smtplib.SMTPException:
print FAIL + "[-] Error: unable to send email to ", to_address, ENDC
Name | Views | Likes |
---|---|---|
Exceptions - SMTPRecipientsRefused | 3107 | 3 |
Python SMTP SMTP.login Function | 505 | 0 |
Python SMTP SMTP.ehlo Function | 949 | 0 |
Exceptions - SMTPSenderRefused | 1809 | 4 |
Python SMTP SMTPAuthenticationError Exception | 1020 | 1 |
Python SMTP SMTPHeloError Exception | 368 | 3 |
SMTP - classes | 580 | 5 |
Python SMTP SMTP.connect Function | 443 | 0 |
Python SMTP SMTPDataError Exception | 860 | 4 |
Python SMTP SMTPNotSupportedError Exception | 902 | 3 |
Exceptions - SMTPServerDisconnected | 2095 | 4 |
Paramiko Library II | 722 | 5 |
Exceptions - SMTPException | 2266 | 4 |
Python SMTP SMTP.docmd Function | 398 | 1 |
Introduction to SMTP | 350 | 5 |
Python SMTP SMTPConnectError Exception | 1986 | 5 |
Paramiko Library | 543 | 5 |
Python SMTP SMTP.auth Function | 651 | 0 |
Exceptions - SMTPResponseException | 880 | 4 |
Comments