> MailMessage msgMail = new MailMessage();
> msgMail.Attachments.Add(new MailAttachment("c:\\temp\\annual-
> report.pdf"));
hi Alexey thanks,
but how do i relate this attachment to the mail that the user is now
sending me?
I mean, if on a webpage there is a form to send an email message to
the webmaster, and is available the option to upload a file and attach
it to this mail, how can this should be coded? (because if the user
upload a file, i don't know the name of that file)
Thanks
Alexey Smirnov - 08 Oct 2007 19:22 GMT
> > MailMessage msgMail = new MailMessage();
> > msgMail.Attachments.Add(new MailAttachment("c:\\temp\\annual-
[quoted text clipped - 9 lines]
>
> Thanks
it's pretty easy, you save the file and attach to a message
For example (c#):
// get the name of the file, Upload is a control name
string fileName = Path.GetFileName(Upload.PostedFile.FileName);
Upload.PostedFile.SaveAs(@"C:\Website\" + fileName);
// then attach it
MailMessage msgMail = new MailMessage();
msgMail.Attachments.Add(new MailAttachment(@"C:\Website\" +
fileName));
....
Look at the following article, I think it does more or less the same
thing
http://www.codeproject.com/useritems/Email_Application.asp
Vinnie - 08 Oct 2007 19:26 GMT
> > > MailMessage msgMail = new MailMessage();
> > > msgMail.Attachments.Add(new MailAttachment("c:\\temp\\annual-
[quoted text clipped - 26 lines]
> Look at the following article, I think it does more or less the same
> thinghttp://www.codeproject.com/useritems/Email_Application.asp
Cool! thanks Master :)