Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
AFAIK @localhost is valid for emails.
For example there are scenarios when you want to send error logs to webmaster@localhost or something like that.
Im suprised that email validator does not allow that. I mean, sure, this blocks users from registering as @localhost, which is good, but still. -
C0D4681385yFilter_var() is using regex based on SMTP acceptable email adrresses derived from this blog post.
https://web.archive.org/web/...
Yes, PHP used a blog post to write a regex to validate email addresses, although it is highly detailed, I'd suggest reading it.
You can find the regex implements here from PHP5, I can't find the PHP7 version on my phone, but I doubt it's any different.
Line: 499
void php_filter_validate_email()
http://svn.php.net/viewvc/php/...
If you're using internal email addresses, then it should be safe just to shove them in since your the only one that's going to be using them right and not requiring a sanity check? -
@C0D4
Yes, its for internal use.
I wont be using it personally, and judging by broad ammount of idiocracy at my company i figured it would be nice if that would validate itself.
But man, nice explanation. Thanx :+1: -
C0D4681385y@DubbaThony it took me longer to find that blog post then it did to know why it didn't work 😅
Damn things been deleted off the face of the interwebs. Bless the web archive.
If you want validation on it just send it to the companies... Gmail account?😅
Swift_mailer is a nice little library 😉 -
-
C0D4681385y@DubbaThony ah cool, your one step ahead of a previous college I had who just used mail() 😞
-
@C0D4
Mail() ?
Someone even knows that this function exists?
Be amazed that he knows the exotic and unused parts of php like em... pnctl_fork or something 😂😂
All seriousness though, I never needed to switch to swift mailer, and in my personal code snippets (copy-pasta between projects) I have nice wrapper that makes sending mails nicer.
Also Im just used to EmailHelper::sendByTemplate("templateName", "someone@somewhere", array("user"=>"DubbaThony")); -
Opinion: email is about as dumb and outdated as faxing, avoid at all costs.
For logging, there's a million better options — from plain cycled text files to kibana/logstash to slack bots to redis lists to database records. Email is a pretty awful backend for system-generated logs.
At work, we use email still as a channel for some system communication (I forgot my password, please send me a reset link) — but for most purposes we use other channels.
For in-platform reminders we use an in-platform notification center. We use mobile push notifications if the user opts in to those. We allow users to connect various chat services. We offer importable calendars so users can stay up-to-date with platform events. For technically inclined end-users, there's an API with webhooks.
From all our research, one thing became painfully clear: Pretty much all our users absolutely hate receiving email, especially from commercial companies.
So my advice: always consider email as the last resort. -
@elpanita Shush, don't make them use JS and steal all the internet with one "npm install"
-
@elpanita lmao
What about no. I dont have time to engage with this discussion so you must deal with it that I choose PHP over JS any day or night.
Hmm...
So apparently root@localhost isn't valid email..
Cmon, PHP, dont betray me like that ;-;
rant