0
안녕하세요, Asp.net에서 이미지 메일을 보내고 싶습니다.은 SiteMap에서 유효한 가상 경로가 아닙니다.
다음과 같은 오류가 발생했습니다 :: 'http://domain-name.com/slideshow/original/Jellyfish.png'은 (는) 유효한 가상 경로가 아닙니다.
내 코드는 다음과 같습니다
try
{
string _SenderEmailID = ReciverEmailID.Text.ToString();
string _ReciverEmailID = ReciverEmailID.Text.ToString();
string _Sender = FullName.Text.ToString();
string post = "JellyBeans.png";
string ImagePath = "http://www.domain-name.com/slideshow/original/";
string iImage = ImagePath + post;
img1.ImageUrl = ImagePath;
MailMessage mail = new MailMessage();
mail.To.Add(_ReciverEmailID);
mail.From = new MailAddress(_SenderEmailID);
mail.Subject = _Sender + " sent you a mail from 'www.domain-name.com";
string Body = "<img alt=\"\" hspace=0 src=\"cid:imageId\" align=baseline border=0 >";
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
LinkedResource imagelink = new LinkedResource(Server.MapPath(ImagePath)+ @post, "image/png");
imagelink.ContentId = "imageId";
imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(imagelink);
mail.AlternateViews.Add(htmlView);
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
smtp.Send(mail);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
LinkedResource에서 Server.MapPath를 제거 할 때 imagelink = 새로운 LinkedResource (iImage, "image/png"); 이제 다음과 같은 새로운 오류가 발생합니다. URI 형식은 지원되지 않습니다. @ Sam Leach –
웹 서버에 이미지를 넣을 수 있습니까? –
예 @Sam Leach는 이미 –