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

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,

JB
LVL 1
JB4375Asked:
Who is Participating?
 
EMB01Connect With a Mentor Commented:
Are you using ASP.Net MVC with C# or VB?  

This article should help you send attachments if that's what you're asking http://www.codeproject.com/Articles/10828/Sending-Email-with-attachment-in-ASP-NET-using-SMT

I recommend using google's outgoing smtp server for improved reception.
0
 
JB4375Author Commented:
VB. Thanks for the link. I'll check it out.

JB
0
 
CodeCruiserConnect With a Mentor Commented:
>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.
0
 
JB4375Author Commented:
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")
        Mail.Attachments.Add(attachment)

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

End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.