- Joined
- May 4, 2009
- Messages
- 1
- Reaction score
- 0
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.
-- 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.