Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all i am making an asp.net web application.. i have an image,and some text on the page..

i want to send that image and text through mail..i have coded like this..

protected void LinkButton1_Click(object sender, EventArgs e)
    {
      //Session["name"] = lblname.Text;
      //Session["rate"] = lblrate.Text;
      //Session["img"] = lblimg.Text;
      Response.Redirect("email.aspx?val=" + Server.UrlEncode(lblname.Text) + "val1=" + Server.UrlEncode(lblrate.Text) + "val2=" + Server.UrlEncode(lblimg.Text));


    }


now on the next page--


public partial class email : System.Web.UI.Page
{
    string val;
    protected void Page_Load(object sender, EventArgs e)
    {
     
     if(Request.QueryString["val"]!=null  || Request.QueryString["val1"]!=null || Request.QueryString["val1"]!=null)
     {

       val = Request.QueryString["val"].ToString() + Request.QueryString["val"].ToString() + Request.QueryString["val"].ToString();
        //val1= Request.QueryString["val1"].ToString();
        //val2 = Request.QueryString["val2"].ToString();
      
     }

    }
    protected void btnsend_Click(object sender, EventArgs e)
    {
      MailMessage msg = new MailMessage();
      msg.To.Add(txtto.Text);
      msg.IsBodyHtml = true;
      msg.Subject = txtsub.Text;
      msg.Body = txtmsg.Text + val;
      msg.From = new MailAddress(txtfrom.Text);


      SmtpClient smtp = new SmtpClient();
      smtp.Host = "smtp.gmail.com";
      smtp.Credentials = new System.Net.NetworkCredential("removed", "remove");
      smtp.EnableSsl = Convert.ToBoolean(true);
      smtp.Send(msg);
     
    }
}




the mail is sending but in the mail there is coming like


subject hi
mailed-by googlemail.com
Images from this sender are always displayed. Don't display from now on.

hide details 12:34 PM (2 minutes ago)

dgBook1val1=1000val2=Book1val1=1000val2=Book1

[EDIT]
Email id and password removed.
Posted
Updated 25-Jun-10 21:38pm
v3
Comments
PSK_ 26-Jun-10 3:36am    
Please use pre tags for your code blocks.
PSK_ 26-Jun-10 3:39am    
Don't mention your original email id and password. You have provided your valid gmail id and password

1 solution

Images from this sender are always displayed. Don't display from now on.

or
Display images below - Always display images from something@codeproject.com


this is normal! for me, all received messages in Gmail, I get this message.

try another smtp server for comparing them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900