Adding an Attachment from an ASP.Net page with VB.Net

Posted on 2012-08-16
Last Modified: 2012-08-24
I have a page that allows a user to submit a ticket to our Help Desk ticketing system Remedy.

For some issues and requests the amount of information required is rather complex. The solution has been to generate a formatted RTF file that contains all of the information submitted.

In testing I've been able to create the file and save it to my hard drive, but for this particular page it wouldn't be acceptable to have the user click an attach button and then browse to the file.  

I really want to be able to save it in the memory space of the page itself, specify the name of the attachment and have it sent on submit.

Could someone direct me to an example?

Thanks in advance,

Question by:JB4375
    LVL 14

    Accepted Solution

    Are you using ASP.Net MVC with C# or VB?  

    This article should help you send attachments if that's what you're asking

    I recommend using google's outgoing smtp server for improved reception.
    LVL 1

    Author Comment

    VB. Thanks for the link. I'll check it out.

    LVL 83

    Assisted Solution

    >In testing I've been able to create the file and save it to my hard drive

    Is that on the server's harddrive?

    >it wouldn't be acceptable to have the user click an attach button and then browse to the file.

    If its on server, user has nothing to do with it. You can attach it directly.
    LVL 1

    Author Closing Comment

    Thanks Guys,

    I was able to do it directly with the following:

    Imports System.Net
    Imports System.Net.Mail

        Public Sub Send_Email()
            Dim Mail As New MailMessage()
            Dim mailBody As String

            Dim attachment As System.Net.Mail.Attachment
            Attachment = New System.Net.Mail.Attachment("filename")

        (Standard here....   Mail To, From, Mailbody etc. )

    End Sub

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now