[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2012-08-16
4
Medium Priority
?
360 Views
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,

JB
0
Comment
Question by:JB4375
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
EMB01 earned 1000 total points
ID: 38300742
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
 
LVL 1

Author Comment

by:JB4375
ID: 38300907
VB. Thanks for the link. I'll check it out.

JB
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1000 total points
ID: 38301017
>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
 
LVL 1

Author Closing Comment

by:JB4375
ID: 38329829
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 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