如何用vb发送图片?

时间:2015-02-02 16:11:23

标签: vb.net email

我有一个充满图片的文件夹(open.SelectedPath),并希望通过电子邮件发送给他们,下面的代码因某些原因无效。下面的代码可以工作。

For Each File In open.SelectedPath
 attachment = New System.Net.Mail.Attachment(File)
 mail.Attachments.Add(attachment)

有效的代码:

  attachment = New System.Net.Mail.Attachment("ImageLocation")
     mail.Attachments.Add(attachment)

感谢任何帮助

1 个答案:

答案 0 :(得分:0)

 For Each foundFile As String In My.Computer.FileSystem.GetFiles(open.SelectedPath)
                    ListBox1.Items.Add(foundFile)
                Next
                For Each item In ListBox1.Items
                    attachment = New System.Net.Mail.Attachment(item)
                    mail.Attachments.Add(attachment)
                Next