mail.Attachments (Multiple Attachments) from Querystring

Discussion in '.NET' started by codewarrior, May 4, 2009.

  1. codewarrior

    codewarrior

    Joined:
    May 4, 2009
    Messages:
    1
    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.
     
    codewarrior, May 4, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Andr=E9s_Berenguer?=

    Sending e-mail with attachments with the default e-mail client

    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=, Aug 29, 2003, in forum: Java
    Replies:
    0
    Views:
    529
    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=
    Aug 29, 2003
  2. Brad
    Replies:
    2
    Views:
    11,336
  3. EdWhyatt
    Replies:
    2
    Views:
    438
    Christos Georgiou
    Mar 18, 2006
  4. tulasikumar
    Replies:
    2
    Views:
    958
    Mark Rae
    Mar 6, 2007
  5. Peter Green
    Replies:
    0
    Views:
    657
    Peter Green
    Nov 5, 2009
Loading...

Share This Page