Dit emails login

You're looking for a script to send a login email with a password reset link. Here's an example in Python using the smtplib library:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import random
import string

# Define the email credentials
email_username = "[email protected]"
email_password = "your_email_password"

# Define the recipient's email address
recipient_email = "[email protected]"

# Define the subject and body of the email
subject = "Password Reset"
body = """
Dear user,

Please click on the following link to reset your password:

http://example.com/reset_password?token={token}

Best regards,
Your App
"""

# Generate a random token
token = ''.join(random.choices(string.ascii_uppercase + string.digits, k=10))

# Create the email message
msg = MIMEMultipart()
msg['From'] = email_username
msg['To'] = recipient_email
msg['Subject'] = subject

# Add the body of the email
msg.attach(MIMEText(body.format(token=token), 'plain'))

# Set up the SMTP server
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(email_username, email_password)

# Send the email
server.sendmail(email_username, recipient_email, msg.as_string())

# Close the SMTP server
server.quit()

This script sends an email with a password reset link that includes a random token. The token is used to verify the user's identity when they click on the link.

Please note that you'll need to replace [email protected] and your_email_password with your actual Gmail address and password. Also, make sure to enable "Less secure app access" in your Google Account settings to allow this script to work.

Also, this is a basic example and you should consider implementing additional security measures such as:

It's also important to note that this script is just an example and you should not use it in production without proper testing and security measures.