You need to sign in to do that
Don't have an account?
MariP
in a class, check a field is a valid email address
Hi everybody,
The users can populate a text area with free email addresses.
I put them in a list (I suppose they have put ";" as a separator between each elements)
How can I check each one is a valid email address ?
Here is my code :
// add user free field to the list of emails if (closedRequest.Others_email_addresses__c!= null) { list<string> lEmailOthersAddressesList = closedRequest.Others_email_addresses__c.split(';', 15);
for(String sOthersAddresses : lEmailOthersAddressesList){
lEmailAddressesList.add(sOthersAddresses);
System.debug('valeur de lEmailAddressesList = ' + lEmailAddressesList);
}
}
Is it possible to test sOthersAddresses to see if it is a valid address email ?
Thanks for any help !
Marie
You can use regular expressions to check that the email address is in the correct format.
http://salesforcesource.blogspot.com/2010/01/utilizing-apex-pattern-and-matcher.html
All Answers
You can use regular expressions to check that the email address is in the correct format.
http://salesforcesource.blogspot.com/2010/01/utilizing-apex-pattern-and-matcher.html
thanks a lot !
Have a nice day !
Great option, But ....
The TDL looks to be defined as max 3 positions, me@somedomain.info is 4 and other TDL are possible now (or near future) as .amsterdam etc.
As I am not familiar with regulair expresions, can someone please modify this string so it can stand the new requirments for email.
Thanks.