MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / matchEmail

Method matchEmail

src/core/provider/MCMailProvider.cpp:153–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153bool MailProvider::matchEmail(String * email)
154{
155 Array * components;
156 String * domain;
157
158 components = email->componentsSeparatedByString(MCSTR("@"));
159 if (components->count() < 2)
160 return false;
161
162 domain = (String *) components->lastObject();
163
164 bool matchExcludeDomain = false;
165 mc_foreacharray(String, exclude, mDomainExclude) {
166 if (matchDomain(exclude, domain)){
167 matchExcludeDomain = true;;
168 break;
169 }
170 }
171 if (matchExcludeDomain) {
172 return false;
173 }
174
175 bool matchValidDomain = false;
176 mc_foreacharray(String, match, mDomainMatch) {
177 if (matchDomain(match, domain)){
178 matchValidDomain = true;
179 break;
180 }
181 }
182 if (matchValidDomain) {
183 return true;
184 }
185
186 return false;
187}
188
189bool MailProvider::matchMX(String * hostname)
190{

Callers 1

mc_foreachhashmapValueFunction · 0.80

Calls 3

lastObjectMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected