Skip to content

Instantly share code, notes, and snippets.

@masnun
Last active June 23, 2018 07:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masnun/77968265134e0594bc45c59deeb69fd2 to your computer and use it in GitHub Desktop.
Save masnun/77968265134e0594bc45c59deeb69fd2 to your computer and use it in GitHub Desktop.
PySelami

How to use?

Install the dependencies from requirements.txt file.

pip install -r requirements.txt

Make the main.py file executable:

chmod +x ./main.py

Now run:

EMAIL="masnun@gmail.com" ./main.py --amount=20000 --to=masnun@gmail.com

The EMAIL env variable is your Gmail / SMTP enabled account. When you run this command, you will be prompted for password (and save to keyring if available). The --amount and --to options can be ignored from the command line and you will get interactive prompts for them.

#!/usr/bin/env python
import yagmail
import os
import click
@click.command()
@click.option('--amount', help='Amount to send', prompt="How much Selami do you want to send?")
@click.option('--to', help='Receiver', prompt="To")
def send_selami(amount, to):
amount = int(amount)
if amount % 1000 != 0:
print("Selami should be multiplier of 1000")
return
bank_notes_needed = int(amount / 1000)
yag = yagmail.SMTP(os.getenv("EMAIL"))
bank_notes = '<img src="https://raw.githubusercontent.com/masnun/eid-selami/master/1000BDT.jpeg" alt="selami" />' * bank_notes_needed
contents = "Hello, <br/> Here's your Eid Selami of {} :) <br/> Download and enjoy! <br/><br/>".format(
amount) + bank_notes
yag.send(to, 'Eid Selami!', contents)
if __name__ == "__main__":
try:
send_selami()
except Exception as ex:
print("Error: {}".format(ex))
click==6.7
entrypoints==0.2.3
keyring==12.2.1
yagmail==0.10.212
@masnun
Copy link
Author

masnun commented Jun 15, 2018

screen shot 2018-06-16 at 5 54 52 am

@Miltonbhowmick
Copy link

What is main thing of this "Eid Sekami" ?
Just sending mail to friends and making prank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment