Subject: E-mail Attachment problem
Posted By: hexOffender Post Date: 5/16/2006 1:54:42 PM
My webform will send an e-mail, but error's out when there is an attachment.(Invalid mail attachment ''.)
some code:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim path As String = Server.MapPath(path)
        Dim file As String = System.IO.Path.GetFileName(fileUploader.PostedFile.FileName)

        filename = path + "\" + file
        fileUploader.PostedFile.SaveAs(filename)

        temp.Text = filename
    End Sub

Private Button2_click()
 Dim mymessage As Mail.MailMessage

        mymessage.From = "HR_applicant@work.org"
        mymessage.To = "me@work.org" 
        mymessage.Subject = "New Applicant Information"
        mymessage.Priority = MailPriority.High
        mymessage.BodyFormat = MailFormat.Text
        mymessage.Body = "This is a test"
        SmtpMail.SmtpServer = "mail1.work.org"
        Dim myAttachment = New MailAttachment(filename, MailEncoding.UUEncode)
        mymessage.Attachments.Add(myAttachment)
        SmtpMail.Send(mymessage)
end sub


What am I missing here to make this not work???


Go to topic 44345

Return to index page 286
Return to index page 285
Return to index page 284
Return to index page 283
Return to index page 282
Return to index page 281
Return to index page 280
Return to index page 279
Return to index page 278
Return to index page 277