Test-IEXEmailAddress2


posted by ps1
09-23-2009

Downloads: 228
File size: 977 B
Views: 757

Embed
Test-IEXEmailAddress2
  1. ## ===================================================================== 
  2. ## Title       : Test-IEXEmailAddress2 
  3. ## Description : Check the validity of an email address. Returns $true for all valid email addresses, otherwise $false. 
  4. ## Author      : Idera 
  5. ## Date        : 09/15/2009 
  6. ## Input       : Test-IEXEmailAddress2 [[-EmailAddress] <String>] 
  7. ##   
  8. ## Output      : System.Boolean  
  9. ## Usage       : 
  10. ##               1. Test email address user2@domain.local 
  11. ##               Test-EmailAddress2 -EmailAddress user2@domain.local 
  12. ## Notes       : 
  13. ## Tag         : email address, validity, .NET Framework, test 
  14. ## Change log  : 
  15. ## =====================================================================  
  16.  
  17.  
  18. function Test-IEXEmailAddress2 
  19.  
  20.     param
  21.         [string]$EmailAddress=$(throw "EmailAddress cannot be empty."
  22.     )   
  23.      
  24.     ($EmailAddress -as [System.Net.Mail.MailAddress]).Address -eq $EmailAddress -and $EmailAddress -ne $null  

Check the validity of an email address. Returns $true for all valid email addresses, otherwise $false.

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.