IndexOf("authentication failed") > -1 if (e.Value.Error.Message.IndexOf("authentication failed") > -1) { strFailMessage = "邮件发送失败 : 此邮箱认证失败(帐号密码不匹配),请在修正后重新尝试。"; } indexof>-1 判断字符串中是否包含某字符串 indexof=-1 字符串中不包含某字符串