public void AddAttachment(string filepath, string cid) { if (filepath != null) { Attachment attachment = new Attachment(filepath); attachment.ContentId = cid; Attachments.Add(attachment); } }
// end added by mb /// <summary>Adds an Attachment to the MailMessage using an Attachment instance</summary> /// <param name="attachment">Attachment you want to attach to the MailMessage</param> /// <example> /// <code> /// MailMessage msg = new MailMessage("*****@*****.**", "*****@*****.**"); /// Attachment att = new Attachment(@"C:\file.jpg"); /// msg.AddAttachment(att); /// </code> /// </example> public void AddAttachment(Attachment attachment) { if (attachment != null) { Attachments.Add(attachment); } }
public string AddImage(string filepath, string cid) { if (filepath != null) { Attachment image = new Attachment(filepath); image.ContentId = cid; _images.Add(image); } return cid; }