Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 16th, 2006, 01:54 PM
Authorized User
 
Join Date: Mar 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default E-mail Attachment problem

My webform will send an e-mail, but error's out when there is an attachment.(Invalid mail attachment ''.)
some code:

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 = "[email protected]"
        mymessage.To = "[email protected]" 
        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???






Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail attachment surendran PHP How-To 0 August 3rd, 2006 06:05 AM
mail with attachment in JAVA rekha_jsr Servlets 8 March 10th, 2006 07:39 AM
mail-attachment sureshdev786 General .NET 0 December 27th, 2004 09:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.