Adding an attachment to email using C#

前端 未结 4 1497
广开言路
广开言路 2020-12-01 13:45

I\'m using the following code from this answer Sending email in .NET through Gmail. The trouble I\'m having is adding an attachment to the email. How would I add an attachme

4条回答
  •  孤街浪徒
    2020-12-01 14:21

    A one line answer:

    mail.Attachments.Add(new System.Net.Mail.Attachment("pathToAttachment"));
    

提交回复
热议问题