0

I am using the MailMessage class to send emails, and I am using the following code to add attachments that will be part of the email, like the button, company logo and a few more. However, I wish these attachments are not sent to the recipient, and that is what is happening. Has anyone ever experienced this? Or is there any way you can not send the attachments? Here is the code I use:

public static MailMessage GetLogoEmailEmpresa(string corpo)
{
        MailMessage msg = new MailMessage();
        AlternateView htmlView = AlternateView.CreateAlternateViewFromString(corpo,null,"text/html");


        LinkedResource logoCompany = null;
        LinkedResource btnEN = null;
        logoCompany = new LinkedResource("../../../../../../WorkerRole/Resources/Images/logoCompany.png");

        logoCompany.ContentId = "logoCompany";
        htmlView.LinkedResources.Add(logoCompany)

        btnEN.ContentId = "botaoEn";
        htmlView.LinkedResources.Add(btnEN);

        msg.AlternateViews.Add(htmlView);

        return msg;
 }
  • why do you add attachments if you don't want to send them? – Homerothompson Oct 18 '17 at 16:29
  • do you mean you want it inline and not as an attachment ? can you push in contents of corpo of how you map the contentId to the view. hope this helps https://stackoverflow.com/questions/19910871/adding-image-to-system-net-mail-message – V4Vendetta Oct 18 '17 at 16:37

0 Answers0