468,720 Members | 1,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

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 967
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**********@Dont.com> wrote in message
news:%2********************@TK2MSFTNGP15.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***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OX**************@TK2MSFTNGP15.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**********@Dont.com> wrote in message
news:%2********************@TK2MSFTNGP15.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Sven Templin | last post: by
5 posts views Thread by morphex | last post: by
6 posts views Thread by Anuradha | last post: by
7 posts views Thread by Ray Booysen | last post: by
3 posts views Thread by lizii | last post: by
reply views Thread by esutcliffe | last post: by
7 posts views Thread by bleachie | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Oskars | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.