problem including picture in email!

Discussion in 'ASP .Net' started by Jeff, Jun 6, 2009.

  1. Jeff

    Jeff Guest

    hi

    asp.net 3.5

    I having trouble include picte in a html email generated by my website. I
    mean this works locally on my computer and I'm testing using Outlook
    Express, but someone I know haves Outlook (not Express) and he doesn't get
    the pictures. I wonder what can cause this? is it because fo wrong URL to
    the picture? is it constraints inside outlook?

    ******** markup of the troubling image tag ********
    <asp:Image ID="thumbnail" runat="server" Width="177" Height="130" />

    ******** code that sets the ImageUrl propertyl ********
    string url = Request.Url.ToString();
    url = url.Substring(0, url.IndexOf(Request.ApplicationPath));
    url += Request.ApplicationPath;
    url += "/Images/ImageThumbnail.aspx?id=" + id.ToString();
    thumbnail.ImageUrl = url;

    ******** code that sends the email ********
    MailMessage msg = new MailMessage(from, recipient);
    msg.Subject = "helloworld";
    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
    WebResponse res = req.GetResponse();
    StreamReader sr = new StreamReader(res.GetResponseStream());
    msg.Body = sr.ReadToEnd();
    msg.IsBodyHtml = true;
    sr.Close();
    res.Close();
    SmtpClient client = new SmtpClient();
    client.Send(msg);
    msg.Dispose();

    any ideas?
     
    Jeff, Jun 6, 2009
    #1
    1. Advertising

  2. Jeff

    Jeff Guest

    fixed, the problem was wrong url in navigateurl


    "Jeff" <> wrote in message
    news:...
    > hi
    >
    > asp.net 3.5
    >
    > I having trouble include picte in a html email generated by my website. I
    > mean this works locally on my computer and I'm testing using Outlook
    > Express, but someone I know haves Outlook (not Express) and he doesn't get
    > the pictures. I wonder what can cause this? is it because fo wrong URL to
    > the picture? is it constraints inside outlook?
    >
    > ******** markup of the troubling image tag ********
    > <asp:Image ID="thumbnail" runat="server" Width="177" Height="130" />
    >
    > ******** code that sets the ImageUrl propertyl ********
    > string url = Request.Url.ToString();
    > url = url.Substring(0, url.IndexOf(Request.ApplicationPath));
    > url += Request.ApplicationPath;
    > url += "/Images/ImageThumbnail.aspx?id=" + id.ToString();
    > thumbnail.ImageUrl = url;
    >
    > ******** code that sends the email ********
    > MailMessage msg = new MailMessage(from, recipient);
    > msg.Subject = "helloworld";
    > HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
    > WebResponse res = req.GetResponse();
    > StreamReader sr = new StreamReader(res.GetResponseStream());
    > msg.Body = sr.ReadToEnd();
    > msg.IsBodyHtml = true;
    > sr.Close();
    > res.Close();
    > SmtpClient client = new SmtpClient();
    > client.Send(msg);
    > msg.Dispose();
    >
    > any ideas?
    >
    >
     
    Jeff, Jun 6, 2009
    #2
    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. anya
    Replies:
    16
    Views:
    23,121
    Ben Finney
    May 29, 2006
  2. Vit
    Replies:
    2
    Views:
    520
    Neredbojias
    Jul 3, 2009
  3. Replies:
    1
    Views:
    172
    Darren Dunham
    Oct 2, 2007
  4. Replies:
    8
    Views:
    1,345
    Mick White
    Apr 19, 2005
  5. paratge
    Replies:
    0
    Views:
    90
    paratge
    Apr 14, 2007
Loading...

Share This Page