0
我有一個頁面,電子郵件可以發送多個附件。這裏是我的代碼通過ASP上傳文件:AjaxFileUpload控件調用ajaxUpload1
:vb.net電子郵件發送和接收,但沒有附件
Protected Sub ajaxUpload1_OnUploadComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AjaxFileUploadEventArgs)
Dim filePath As String = "~/Uploads/" & Convert.ToString(e.FileName)
' Save upload file to the file system
ajaxUpload1.SaveAs(MapPath(filePath))
e.PostedUrl = Page.ResolveUrl("~\uploads\" + e.FileName)
Try
emailAttachment = New System.Net.Mail.Attachment(filePath)
attahchemnts.Add(emailAttachment)
Catch ex As Exception
Label2.Text = ex.ToString
End Try
End Sub
是由所有上傳的文件名列表。
而且該位負責在按鈕單擊事件
Try
If ajaxUpload1.HasAttributes Then
For counter As Integer = 0 To attahchemnts.Count
mail.Attachments.Add(attahchemnts.Item(counter))
Next
End If
Catch ex As Exception
Label2.Text = ex.ToString
End Try
問題設置郵件的附件是我能夠成功發送和接收電子郵件,但我看不到電子郵件附件。任何人都有線索?由於