Email validation

Mike Wey mike-wey at example.com
Tue Nov 28 22:42:27 UTC 2017


On 28-11-17 20:32, Vino wrote:
> On Tuesday, 28 November 2017 at 18:51:50 UTC, Rene Zwanenburg wrote:
>> On Tuesday, 28 November 2017 at 18:47:06 UTC, Vino wrote:
>>> Hi All,
>>
>> You can do this easily using the std.net.isemail module:
>>
>> https://dlang.org/phobos/std_net_isemail.html
> 
> Hi Rene,
> 
>   Can you provide me a example, as the link does not have any examples.
> 
> From,
> Vino.B

isEmail returns a struct with the status of the check.
You can use the valid and domainPart to check if it's a valid email 
address for the hotmail domain.

isMail only checks the formatting of the email address and optionally if 
the domain has a MX record.


```
auto e = isEmail("vino.bheeman at hotmail.com");

if ( e.valid && e.domainPart == "hotmail.com" )
	...
```

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list