62,047
社区成员
发帖
与我相关
我的任务
分享
Regex re = new Regex("<[img|IMG].+?src=[\"|']?([^\"]+?)[\"|']?(?: .*?>|>)");
string s1 = "";
MatchCollection mc;
mc = re.Matches(body);
for(int i=0;i < mc.Count;i++)
{
s1 = mc[i].Groups[1].Value ;
string path = Server.MapPath(s1);
string contentid = Jmail.AddAttachment(path, true, "image/jpg");
string replaced = "cid:"+contentid;
body = Regex.Replace(body, mc[i].Groups[1].Value, replaced);
}