1
Googleの交換サーバープロバイダによって更新されたため、残念ながら画像が埋め込まれたメールは送信できません。Exchangeサーバーは画像が埋め込まれたメールをブロックします
電子メールを送信すると、「リモートサーバーからエラーが返されました:(401)Unauthorized」というエラーが表示されます。 メールから画像を削除すると、すべて正常に機能します。 この問題の回避策はありますか?
当社のC#コード:
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
LinkedResource imagelink;
MatchCollection matches = Regex.Matches(Body, "<img.*?src=\"cid:(.*?)\"");
foreach (Match match in matches)
{
myHttpWebRequest = (HttpWebRequest)WebRequest.Create(new Uri(match.Groups[1].Value));
myHttpWebRequest.UseDefaultCredentials = true;
myHttpWebRequest.PreAuthenticate = true;
myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
using (myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse())
{
receivedStream = myHttpWebResponse.GetResponseStream();
MemoryStream streamReceivedCopy = new MemoryStream();
ImageUtils.CopyStream(receivedStream,streamReceivedCopy);
var imageType = ImageUtils.GetImageMIMEType(streamReceivedCopy);
streamReceivedCopy.Position = 0;
imagelink = new LinkedResource(streamReceivedCopy, imageType);
imagelink.ContentId = match.Groups[1].Value;
imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(imagelink);
}
}
mail.AlternateViews.Add(htmlView);
は、我々は、エラーを追跡するために私たちが管理し、電子メール