In a C# desktop App I send a mail to a specific user and it has an image and the end of the body as shown below
MailMessage email = new MailMessage();
email.To.Add(new MailAddress(correo));
email.From = new MailAddress("email@email.com");
email.Subject = "some text ( " + DateTime.Now.ToString("dd / MMM / yyy hh:mm:ss") + " ) ";
email.Body = "some text";
email.IsBodyHtml = true;
email.Priority = MailPriority.Normal;
string text = "some text";
AlternateView plainView = AlternateView.CreateAlternateViewFromString(text, Encoding.UTF8, MediaTypeNames.Text.Plain);
LinkedResource LinkedImage = new LinkedResource(@"C:\Users\myUser\Documents\App\CPresentacion\Resources\comunicaciones.jpg");
LinkedImage.ContentId = "ImagenGCI";
LinkedImage.ContentType = new ContentType(MediaTypeNames.Image.Jpeg);
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
"some text <br/><img src=cid:ImagenGCI>", Encoding.UTF8,
MediaTypeNames.Text.Html);
htmlView.LinkedResources.Add(LinkedImage);
email.AlternateViews.Add(htmlView);
email.AlternateViews.Add(plainView);
SmtpClient smtp = new SmtpClient();
smtp.Host = "192.xxx.x.xxx";
smtp.Port = 25;
smtp.EnableSsl = false;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("email@email.com", "");
string output = null;
try
{
smtp.Send(email);
email.Dispose();
output = "Correo electrónico fue enviado satisfactoriamente.";
CargarDGV();
Limpiar(this);
}
catch (Exception ex)
{
output = "Error enviando correo electrónico: " + ex.Message;
}
and it works fine when I send the email from my computer but it cannot find the image when another user in another computer tries to sen the email from the App, I know the problem is in the linkedResource path but don´t know how to specify the path to work in another computer, this is my project' folders, could you please help to specify the correct path in order to work in any specific computer