Code Monkey home page Code Monkey logo

massmail's People

Contributors

debilski avatar jakobj avatar keszybz avatar otizonaizit avatar sappelhoff avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

massmail's Issues

Python3 conversion

Massmail should be converted to Python3, while maintaining backwars compatibility with Python2. This requires special attention to how unicode is currently handled.

Create a function to check the validity of an email address given as a parameter.

In a dedicated function, use re.match() to check the validity of a given email address. The function can then be called to test the validity of the FROM parameter, as well as for every addresses extracted from the parameter file. It should use a variant of the following regex (from: https://www.scottbrady91.com/Email-Verification/Python-Email-Verification-Script):

import re

addressToVerify ='[email protected]'
match = re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', addressToVerify)

if match == None:
	print('Bad Syntax')
	raise ValueError('Bad Syntax')

Do not send emails by default

To avoid accidentally sending ill-formated emails, the default behaviour should be to not send the emails, but only print header and body to stdout. A fake option exists at the moment (-f). One should make the fake run the default, and introduce a positive version of the command line argument.

Fix return value on error

The return value from programs is an integer between 0 and 255, and 1 should be used as "generic error". Fix the return value.

Introduce rate limiting options

Nowadays SMTP servers are more and more strict about how many emails you can send within a session and within a certain time. We should support this in massmail. We need two things:

  • limit the number of emails per SMTP session
  • limit the send-rate by introducing a time.sleep after sending every single email

Both things should be controllable with a command-line switch, both off by default.

Refactor massmail

The script should be refactored into functions to allow for proper testing.

Check syntax of mail

The syntax for using keyword arguments is the mail should be made sure to be consistent, i.e.,

  • every opening $ should either be followed by a keyword and a closing $ as in $NAME$
  • dollar signs should be escaped by a $, i.e., to write $ in the mail one would need to write $$

If the mail text violates any of these conditions, the program should print an informative error message and exit. Users should be able to override this check by providing a special command line argument.

Make help return 0

It's not an error, the return value (according e.g. to gnu program specifications) to be 0.

Copyright date

The date stated in the copyright statement is outdated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.