Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > mail.Attachments (Multiple Attachments) from Querystring

Reply
Thread Tools

mail.Attachments (Multiple Attachments) from Querystring

 
 
codewarrior codewarrior is offline
Junior Member
Join Date: May 2009
Posts: 1
 
      05-04-2009
Can someone please help me with an issue I am having with sending emails using System.Net.Mail; I am passing in the querystring 1 image and it attaches fine but now I need to be able to have multiple attachments in the email that come from the querystring as separated values.

-- Works fine
string tmpNewFile = Request.QueryString["tmpNewFile"];
mail.Attachments.Add(new Attachment(tmpNewFile));

-- Example URL with querystring tmpNewFile and 1 image
?tmpNewFile=image1.jpg

-------------------------------------------------------------------
-- I want to be able to add multiple attachments that come from the querystring but don't know how to do it? The will be passed in the querystring this way with a ; but I can change it if needed.

?tmpNewFile=image1_.jpg; image2_.jpg

-------------------------------------------------------------------
-- I saw this on the internet but don't know if it will work for me and if so how I would implement it to work the way I need to.

ICollection<System.Net.Mail.Attachment> attachments

foreach (string str in myattach)
{
if (str.Trim() != "")
{
mail.Attachments.Add(new Attachment(Path.GetFullPath(str)));

}
}

if (attachments != null)
{
foreach (System.Net.Mail.Attachment att in attachments)
{
mail.Attachments.Add(att);
}
-------------------------------------------------------------------
Any help would be greatly appreciated.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get value of QueryString inside QueryString Mehdi ASP .Net 6 04-06-2006 03:41 PM
Passing QueryString URL as a paremeter in QueryString Adeel Ahmad ASP General 1 03-07-2006 02:05 PM
querystring in masterpages - please help suzy ASP .Net 3 04-16-2004 12:26 PM
Re: Pack QueryString Natty Gur ASP .Net 0 06-29-2003 02:48 PM
Pack QueryString Axel Dahmen ASP .Net 2 06-29-2003 01:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57