Thread: [GENERAL] Build in function to verify email addresses

[GENERAL] Build in function to verify email addresses

From
Nick Dro
Date:
I beleieve that every information system has the needs to send emails.
Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (xxx@YYY.com / .co.ZZ)
Do you believe such function should exist in PostgreSQL or it's best to let every user to implement his own function?

Re: [GENERAL] Build in function to verify email addresses

From
Pavel Stehule
Date:
Hi

2017-11-16 8:56 GMT+01:00 Nick Dro <postgresql@walla.co.il>:
I beleieve that every information system has the needs to send emails.
Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (xxx@YYY.com / .co.ZZ)
Do you believe such function should exist in PostgreSQL or it's best to let every user to implement his own function?

I don't think so this functionality should be in upstream - but it is good use for some extension and placing it in PGXN or PostgreSQL community repository.

Postgres has good regexp support and this case can be implemented by one regexp.

you can use PLPerlu and use some modules from CPAN


Regards

Pavel


Re: [GENERAL] Build in function to verify email addresses

From
Chris Withers
Date:
I'm pretty sure this isn't as simple as you think it is, I'd suggest 
having a good read of:

https://stackoverflow.com/a/201378/216229

Chris


On 16/11/2017 07:56, Nick Dro wrote:
> I beleieve that every information system has the needs to send emails.
> Currently PostgreSQL doesn't have a function which gets TEXT and 
> return true if it's valid email address (xxx@YYY.com / .co.ZZ)
> Do you believe such function should exist in PostgreSQL or it's best 
> to let every user to implement his own function?



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Build in function to verify email addresses

From
"btober@computer.org"
Date:



From: "Nick Dro" <postgresql@walla.co.il>
To: pgsql-general@postgresql.org
Sent: Thursday, November 16, 2017 2:56:42 AM
Subject: [GENERAL] Build in function to verify email addresses

I beleieve that every information system has the needs to send emails.
Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (xxx@YYY.com / .co.ZZ)
Do you believe such function should exist in PostgreSQL or it's best to let every user to implement his own function?

I don't mean to sound snarky, but did you even try to google search?


https://github.com/asotolongo/email

or

https://github.com/petere/pgemailaddr



-- B




Re: [GENERAL] Build in function to verify email addresses

From
Andreas Joseph Krogh
Date:
På torsdag 16. november 2017 kl. 09:05:00, skrev Pavel Stehule <pavel.stehule@gmail.com>:
Hi
 
2017-11-16 8:56 GMT+01:00 Nick Dro <postgresql@walla.co.il>:
I beleieve that every information system has the needs to send emails.
Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (xxx@YYY.com / .co.ZZ)
Do you believe such function should exist in PostgreSQL or it's best to let every user to implement his own function?
 
I don't think so this functionality should be in upstream - but it is good use for some extension and placing it in PGXN or PostgreSQL community repository.
 
Postgres has good regexp support and this case can be implemented by one regexp.
 
you can use PLPerlu and use some modules from CPAN
 
 
Regards
 
Pavel
 
In general, I see no reason for a modern RDBMS not to provide an email-datatype. IMV that's no different from other types which also could have been plain-text but are convenient to have datatypes for.
Being an open-source project I guess one must show initiative and start a discussion on -hackers to see what interesst there's in having one in core. I for one hope there will be.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 

Re: [GENERAL] Build in function to verify email addresses

From
Michael Nolan
Date:


On Thu, Nov 16, 2017 at 1:56 AM, Nick Dro <postgresql@walla.co.il> wrote:
I beleieve that every information system has the needs to send emails.
Currently PostgreSQL doesn't have a function which gets TEXT and return true if it's valid email address (xxx@YYY.com / .co.ZZ)
Do you believe such function should exist in PostgreSQL or it's best to let every user to implement his own function?

There's a world of difference between an email address that is well-formed and one that actually works. 

In the systems I administer there's a lot of time spent dealing with bounced mail to make sure that the email addresses we have actually reach someone, hopefully the intended target.  And in the US, bulk emailers also have to deal with the CAN-SPAM act, which specifies procedures that must be in place to allow easy administrative options to remove one'e email address from mailing lists. 

Procedures to verify that an email address works and to administer its use under rules like CAN_SPAM cannot exist solely within the database itself.  And as others have noted, what makes for a 'well-formed' email address has always been a bit complicated. 
--
Mike Nolan