473,765 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User sending email attachments?

I know how to send emails using ASP.NET. How can I allow the user to attach
a file to an email that they submit (via an ASPX online submission form)?

Ex: Allow user to submit a resume along with their info.
Nov 19 '05 #1
2 1060
I'm assuming that the user would attach the file from their own computer? If
so, you would need to have a File Upload control on the form, so that when
they submit the form, the file to attach is sent to the server with it.

In the System.Web.Mail namespace you'll find 3 classes:

SmtpMail
MailMessage
MailAttachment

You would create the MailAttachment from the uploaded file, format a
MailMessage instance, add the MailAttachment to the MailMessage's
Attachments Collection, and use the SmtpMail class to send the MailMessage.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"VB Programmer" <xD**********@D ont.com> wrote in message
news:%2******** ************@TK 2MSFTNGP15.phx. gbl...
I know how to send emails using ASP.NET. How can I allow the user to
attach a file to an email that they submit (via an ASPX online submission
form)?

Ex: Allow user to submit a resume along with their info.

Nov 19 '05 #2
Will the MailAttachment namespace upload the attachment automatically from
the users pc to the server? Or, do I have to code this?

Thanks!

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:OX******** ******@TK2MSFTN GP15.phx.gbl...
I'm assuming that the user would attach the file from their own computer?
If so, you would need to have a File Upload control on the form, so that
when they submit the form, the file to attach is sent to the server with
it.

In the System.Web.Mail namespace you'll find 3 classes:

SmtpMail
MailMessage
MailAttachment

You would create the MailAttachment from the uploaded file, format a
MailMessage instance, add the MailAttachment to the MailMessage's
Attachments Collection, and use the SmtpMail class to send the
MailMessage.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"VB Programmer" <xD**********@D ont.com> wrote in message
news:%2******** ************@TK 2MSFTNGP15.phx. gbl...
I know how to send emails using ASP.NET. How can I allow the user to
attach a file to an email that they submit (via an ASPX online submission
form)?

Ex: Allow user to submit a resume along with their info.


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
4312
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
5
12733
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall
4
3977
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Unspecified error --- End of inner exception stack trace ---
6
2750
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
7
4388
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the framework reports the following exception: "System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown
3
1551
by: lizii | last post by:
Hey there - hopefully last newbie question i will ask for a while! I want my application to work where you click a button - and it either: a) open a email application - insert the correct email address and add a subject + any attachments or b) just create an email and send it off with appropriate attachments etc.
0
1323
by: esutcliffe | last post by:
Greetings, How do I close MS Outlook after use reviews the email before sending? I open MS Outlook application and create an email. But at the end of the function I do not Quit Outlook as I want the user to review the email before sending. Once the email is sent, an instance of Outlook is left hanging out there open. I am not sure where or how to place the "Quit" once the
7
8559
by: Paridevi | last post by:
Hai , i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any details. Pls its urgent for me. Can any one give me any idea about this. Thanks in advance Pari
7
3338
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of guests added. form.php function createGuestNameAndEmailElements() {
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.