33
votes
Accepted
Accurate email syntax validation (no seriously)
"@"@example.com and "\ "@example.com both fail, but they are valid.
...
24
votes
Accurate email syntax validation (no seriously)
Said this in chat already, but @ succeeds even although it is not a valid email address. You should require at least 1 character in the local part and 1 character ...
24
votes
Accurate email syntax validation (no seriously)
I personally find it hard to fault your code.
Actually I'm quite surprised about the absence of code.
Other than a few PEP8 errors there are three changes that I would recommend.
You remove both <...
22
votes
Accepted
Send daily email alerts of the Bitcoin Price
Define some constants
I'd make some constants and put them at the top of the program because if your program becomes bigger, it'll be harder to change their values:
...
17
votes
Accurate email syntax validation (no seriously)
You seems to build your module to contain only validate as "public" function. You may want to enforce that by declaring ...
16
votes
Send daily email alerts of the Bitcoin Price
It seems to me that running a specific command at a specific time each day is more the job of a cron daemon than of said command. As such, I would simplify the ...
13
votes
Telling me what lesson I have tomorrow and emailing me the results
I would change the data organization to be the opposite way, to have a dict mapping to the two week types containing a dict with a mapping from the weekday to the lessons:
...
12
votes
Accurate email syntax validation (no seriously)
The code that you've written is generally really good, but as you seem to have found parsing non-trivial strings starts to get kind of complicated, and has all sorts of room for nasty edge cases.
Your ...
12
votes
Accepted
Analyze frequency and content of political fundraising E-mails
Let's start with the obvious: this code doesn't run. You're missing ans = starter() so that further (el)if ans.lower() == ... ...
11
votes
Accepted
Are your servers down...?
I'll proceed top to bottom.
mail_error
Which would you rather read: x.body = e.message or ...
10
votes
Accepted
Replace many Outlook email rules with a script
Here's some changes I would make.
First thing I would do is make most of this module level variables, initialized in your Application_startup method, and taking advantage of WithEvents to setup the ...
10
votes
Accepted
Sending text and HTML email using smtplib & MIMEText
The goals of this will be to make the code more readable and maintainable.
Don't put templates and credentials in your code.
Most of the class-level declarations of ...
10
votes
Accepted
Python program that obfuscates an email address
The code is straightforward and reads well, but:
string concatenation is not very efficient, especially in a loop. You'd be better off using str.join on an ...
9
votes
Email checker ('@' sign, provider, domain extension)
My first comment would probably be that you shouldn't try to validate emails beyond checking that they have at least one character before an @ sign, one ...
9
votes
Accepted
Simple email validation script
Interface design
The current design of the validator class is not very intuitive.
Users of this class must call the check_for_symbol and ...
9
votes
Accepted
Verifying user accounts on SMTP servers
What you really want is a robust argument parsing. This calls for argparse:
...
9
votes
Accepted
Bash script to truncate subject line of incoming email
Be sure to read the relevant RFCs that govern e-mail headers! Specifically:
RFC 2822, Section 1.2.2: Header names are case-insensitive.
RFC 2822, Section 2.2.3: Header fields may be line-folded:
2....
9
votes
Accepted
Weekly MySQL database backup
Overall
This is totally decent code and not too difficult to maintain. Your variable names make sense and you've made some effort at not repeating yourself, other than the lack of a loop which you ...
8
votes
8
votes
Replace many Outlook email rules with a script
I'm too new to comment and I'm not sure this qualifies as an answer, but there are a couple changes I'd suggest:
Consider removing the conditions (from, subject-contains, etc.) from the "executing" ...
8
votes
Accepted
C# SMTP notifier client
I believe I would take the Notifier constructor and pass in both the Port & Host information. When I instantiate the class I would pass these values in.
Good idea.
Both the ...
7
votes
Accepted
Counting e-mails in a mailbox for each hour
Formatting
Please follow PEP8, the Python style guide.
Most noticeably,
use 4 spaces to indent.
Working with files
The recommended way to work with files is using ...
7
votes
Accurate email syntax validation (no seriously)
Instead of reviewing your code, I looked at your tests.
You do not seem to support IPv4 mapped IPv6 addresses:
validate('hello@[::FFFF:222.1.41.90]')
(See http:/...
7
votes
Accepted
Using SendAsync to send multiple emails
From the SendAsync docs:
After calling SendAsync, you must wait for the e-mail transmission to
complete before attempting to send another e-mail message using Send
or SendAsync.
So no, this ...
7
votes
Accepted
E-store automatic email send, to be run daily
There are good and bad things about the code, but I will focus on some things that I believe to be bad about the code.
The EmailSenderProgram namespace should be ...
7
votes
Bash script to truncate subject line of incoming email
Generally good code - plus points for good use of stdout/stderr and exit status.
Shellcheck reported some issues:
...
7
votes
Accepted
Function to send email, refactored based on SOLID principles
I'd still say that you should break apart the mail message and SMTP client into separate classes for the "Single responsibility principle". In specific:
A class should only have a single ...
6
votes
Accepted
Colored <hr> in emails
Email formatting is very archaic
Like, stone-age archaic. Like, HTML 4 but with most of the "cool" things (like <style> blocks and separate CSS ...
6
votes
Analyze frequency and content of political fundraising E-mails
Setting aside PEP 8 (official style guide) issues I would make the following change:
Rather than keeping your politician bins, names and email addresses in separate data structures (the only way they ...
6
votes
Analyze frequency and content of political fundraising E-mails
Imagine how much of a pain it would be to add another politician to this list. In addition to the Politician class suggested in another answer, I would suggest ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
email × 284python × 75
php × 59
c# × 42
java × 31
beginner × 26
validation × 26
python-3.x × 25
html × 19
security × 19
javascript × 15
performance × 15
ruby × 15
object-oriented × 13
python-2.x × 13
form × 12
.net × 9
asynchronous × 8
multithreading × 7
parsing × 7
regex × 7
bash × 7
linux × 7
status-monitoring × 7
vba × 6