Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

35 votes

Regex validation for Email Address

I remember having read somewhere (possibly in another Code Review answer) that for an e-mail address, the simplest and most effective validation you can do is to make sure it contains an ...
user avatar
32 votes
Accepted

Accurate email syntax validation (no seriously)

"@"@example.com and "\ "@example.com both fail, but they are valid. ...
user avatar
  • 460
27 votes

PHP mail form is being abused

Your script is vulnerable to a header-splitting attack. Due to the poor design of PHP's mail() function, it is actually quite easy to introduce that kind of ...
user avatar
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 ...
user avatar
  • 22.2k
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 <...
user avatar
  • 41.6k
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: ...
user avatar
20 votes

Regex validation for Email Address

As @Simon pointed out, your regular expression might consider some valid addresses as invalid. Per this source which I've found somewhere on this Stack Overflow page, this would be RFC5322-compliant: ...
user avatar
19 votes
Accepted

PHP mail form is being abused

I'm not a php expert, but from reading up on the documentation it appears that it may be possible to insert additional from/to addresses using the "Additional Headers" field on the ...
user avatar
  • 653
17 votes

Email validation using JavaScript

I disagree with rolfl's assertion that, "There is no practical way to validate an e-mail address by regex alone." He is correct—as illustrated by the somewhat infamous SO answer he linked to—that it'...
user avatar
  • 940
17 votes

E-mail testing code

First, heed what Jeroen Vannevel said; it will save you much grief. Of all the assumptions you've made here, only one is correct: there has to be an @ in the ...
user avatar
  • 20.3k
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 ...
user avatar
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 ...
user avatar
15 votes

Send email just once per day

Couple of remarks: IsSent() smells like a property, not a method. It should be more descriptive as well: what object are you calling this on? It seems to indicate ...
user avatar
14 votes

E-mail testing code

Email validation aside... Switching between GUI input and console output You take your input via a JOptionPane, but the output of your validation is displayed via ...
user avatar
  • 19.1k
13 votes

Regex validation for Email Address

It was suggested that I move this to an answer instead of a comment: Since you're using .NET, why not just use System.Net.Mail.MailAddress? It already performs ...
user avatar
  • 3,588
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: ...
user avatar
  • 40.5k
12 votes
Accepted

HTML inline CSS

Broken HTML Browsers are forgiving. I see a fairly nice looking page, but the truth is, this HTML is seriously broken. ...
user avatar
  • 107k
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 ...
user avatar
  • 840
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() == ... ...
user avatar
11 votes
Accepted

Application please send me an E-mail

Some thoughts about the code itself. In general method names recommended as Pascal Case so sendEmail should ideally be named ...
user avatar
  • 6,407
11 votes
Accepted

Network Downtime

Argument handling $defaultmail and $defaultip are poorly named — there is a naming inconsistency: ...
user avatar
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 ...
user avatar
10 votes

Send email just once per day

Normally, you don't catch Exceptions to throw them again, it doesn't make sense, let them rise up, don't catch them here, I don't think it is your intention to stop the exceptions here, so don't. ...
user avatar
  • 28.5k
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 ...
user avatar
  • 1,726
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 ...
user avatar
  • 8,392
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 ...
user avatar
9 votes

PHP mail form is being abused

Never, EVER directly use a $_GET or $_POST variable without checking its content first. Instead of: ...
user avatar
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 ...
user avatar
  • 7,673
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 ...
user avatar
  • 107k
9 votes
Accepted

Verifying user accounts on SMTP servers

What you really want is a robust argument parsing. This calls for argparse: ...
user avatar
  • 40.5k

Only top scored, non community-wiki answers of a minimum length are eligible