📧 Send Emails Using Termux with SMTP + Gmail App Password 🔐

Hey Guys, It's me SaadMaqsood 🙋🏻‍♂️ and today we’re making your Android send real emails using Termux 🧑‍💻🔥 Yup, no apps needed. No shady tools. Just your phone, Termux, Python & Gmail’s SMTP server 📲💌 Let’s GO 🚀


✨ How will se send emails with Termux?

We’re using SMTP (Simple Mail Transfer Protocol) — it’s how emails are sent behind the scenes 💻 And with Gmail’s App Password, we’ll bypass login issues safely (Gmail doesn’t allow normal password usage via apps anymore ❌🔑)


🔧 What You’ll Need

  1. A Gmail account with 2-Step Verification enabled 🔒
  2. Termux installed → Download Termux
  3. Python installed in Termux

📦 Step 1: Install Python in Termux

Open Termux and run:

pkg update && pkg upgrade -y
pkg install python -y


🔑 Step 2: Get Gmail App Password

  1. Open Google Account Security Settings
  2. Enable 2-Step Verification if not already ✅
  3. Scroll to “App Passwords” and log in again 🔐
  4. Choose Mail as the app and Other → name it like “Termux SMTP”
  5. Click Generate and copy the 16-digit password 📋

🧠 Step 3: Create the Python Email Script

Let’s make a file to send emails. Run:

nano emailer.py

Paste this clean code ⬇️

# Email Sender using Gmail SMTP + App Password
import smtplib
from email.message import EmailMessage

# ⚙️ SETTINGS
your_email = "youremail@gmail.com"
app_password = "abcd efgh ijkl mnop"  # Your Gmail App Password

# ✉️ EMAIL BODY
subject = "Hello from Termux 👋"
body = "Yo! This email was sent using Termux & Python 😎"
to_emails = [
    "friend1@gmail.com",
    "friend2@gmail.com"
]

# 💌 SEND EMAIL
msg = EmailMessage()
msg["From"] = your_email
msg["To"] = ", ".join(to_emails)
msg["Subject"] = subject
msg.set_content(body)

try:
    with smtplib.SMTP_SSL("smtp.gmail.com", 465) as smtp:
        smtp.login(your_email, app_password)
        smtp.send_message(msg)
        print("✅ Email sent successfully!")
except Exception as e:
    print("❌ Error:", e)


🚀 Step 4: Run the Script

python emailer.py

If everything’s 🔥, you’ll see “✅ Email sent successfully!” in the Termux terminal 🎉


🪄 Bonus: Add Unlimited Emails

Wanna mail a whole list? Edit this part of your code:

to_emails = [
    "client1@example.com",
    "client2@example.com",
    "client3@example.com"
]

Pro tip: You can load emails from a text file too 👀 (I’ll drop that version soon 🤫)


🔗 Related Guides


🛡️ Security Notes

  • Never use your real Gmail password here ❗
  • Don’t share your App Password with anyone 🙅‍♂️
  • Always stay within Gmail’s fair use limits 📬

🤘 Final Thoughts

With Termux + Python, you can automate almost anything — from sending emails to building bots to scraping the web. This is just the beginning, fam 💡. Wanna send emails to 100+ leads every day with AI content? Stay tuned for my upcoming tutorial where I’ll combine this with 💥 Termux API and some crazy automation 🤯

Stay Ethical 👾





Post a Comment

0 Comments

Popup Image