2

Hmm...

So apparently root@localhost isn't valid email..

Cmon, PHP, dont betray me like that ;-;

Comments
  • 4
    It's not wrong 😑
  • 1
    Try getting a subdomain
  • 2
    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.
  • 2
    Filter_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?
  • 0
    @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:
  • 2
    @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 😉
  • 1
    @C0D4

    I just use PHPMailer and have nice wrapper that works in my code sooo nicely ;)
  • 3
    @DubbaThony ah cool, your one step ahead of a previous college I had who just used mail() 😞
  • 1
    root@fuckyou.localhost.localdomain
  • 0
    @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"));
  • 0
    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.
  • 0
    @bittersweet

    Implementation time... In minutes.

    Cant beat it.
  • 0
    @DubbaThony

    curl -X post --data 'some json...' <slack-webhook-url>
  • 0
    You had it all wrong since used php
  • 0
    @elpanita Shush, don't make them use JS and steal all the internet with one "npm install"
  • 0
    Literally anything else than php
  • 1
    @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.
Add Comment