|
<pre>
string Body;
AlternateView htmlIV;
SqlConnection _oSqlconn;
SqlCommand _oSqlCmd;
SqlDataAdapter _oAdapt = new SqlDataAdapter();
DataTable DT;
DT = new DataTable();
string Sqlstr;
_oSqlconn = new SqlConnection(ConfigurationManager.AppSettings["Test"]);
_oSqlconn.Open();
Sqlstr = "select cEmail_id1 from Master_Contacts";
_oSqlCmd = new SqlCommand(Sqlstr, _oSqlconn);
_oSqlCmd.CommandType = CommandType.Text;
_oAdapt.SelectCommand = _oSqlCmd;
_oAdapt.Fill(DT);
_oSqlconn.Close();
Body = "<table cellpadding='0' cellspacing='0' bgcolor='#c1c1c1' align='center' width='100%' border='0'>";
Body += "<td align='center'>";
Body += "<table cellpadding='0' cellspacing='0' align='center' width='600' height='703' border='0'>";
Body += "<tr>";
Body += "<td align='center'><img alt='' hspace=0 src='cid:imageId' align=middle border=0 ></td>";
Body += "</tr>";
Body += "</table>";
Body += "</td>";
Body += "</tr>";
Body += "</table>";
htmlIV = System.Net.Mail.AlternateView.CreateAlternateViewFromString(Body, null, "text/html");
System.Net.Mail.LinkedResource imagelink = new System.Net.Mail.LinkedResource(Server.MapPath(".") + "\\images\\S.jpg", "image/jpeg");
imagelink.ContentId = "imageId";
imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlIV.LinkedResources.Add(imagelink);
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("xyc2@yahoo.com", Convert.ToString(DT.Rows[i]["cEmail_id1"]), ConfigurationManager.AppSettings["Subj"], Body);
mail.AlternateViews.Add(htmlIV);
System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["MailID"], ConfigurationManager.AppSettings["Pass"]);
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 25);
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(mail);
</pre>
Above is the way i used to send a mail with embed image and this becomes slow to send mail i.e to send 5 mails for example it takes 3 minutes.
II
i tried to write an image inside td of Body message src=mypath instead of
src='cid:imageId' but result is i am getting mails deliverd but if i open a mail then mail not displayed any images
|
|
|
|
|
specify full path of your image like
http://yoursite.com/images/S.JPG....
|
|
|
|
|
Hi
Thanks image got displayed when i give path as you mentioned but in gmail when opening mail gmail is showing diplay images below i dont want to get message rather it should display image when user open a mail, can u tell me why i am getting error
|
|
|
|
|
No chance at all!!!. It's gmail's property. we can't change it...
|
|
|
|
|
hi
ok i agree with you and thanks a lot for your suggestion
|
|
|
|
|
Hello to everybody,
I'm currently developing a 2 level menu using jQuery... I load data from a Webservice and populate the toplevel item and sublevelitems... my webapplication is made of ascx and I've got a main page that load the ascx, I was wondering if there's a way using jQuery to notify the server that a menu item has been clicked ( I tried creating an ajax asp.net server control menu but got lost, so I moved to jQuery)...
Thanks in advance
Paolo
|
|
|
|
|
Hello,
I am planning to embed an ASPX file in my web application as an embedded resource. Now, when I call the file as an web resource url, I get the file downloaded as a text file instead of being executed. So, I think, if there is a correct mime type I can set for this aspx file, I can let the IIS know to execute it. Can you give me any idea?
I tried Virtual File System instead of web resource, and it works fine but only problem is, Virtual file cant be run on medium trust level hosting. So, your help is highly appreciated.
Regards,
Emran
|
|
|
|
|
IIS can only execute files, it can't execute a response. There is no mime type that can change that.
What is the reason that you want an aspx file as a resource? What is it that you are trying to accomplish, really?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
Thanks for the reply. Actually I am developing a Custom Server control where I render an IFRAME and I want to provide the content of the Src attribute of the IFRAME as an aspx file and I want to provide the file from embedded resource. If I use Virtual File system, It works, but as I said, Virtual File system does not usable in Medium trust hosting so I was thinking about using Embedded Resourse.
I dont want to ship any other aspx file beside my control dll as it will arise confusion to my user. Mroeover, I want to hide the code of the aspx file too.
Is there any better idea available to fulfil this purpose. !!
|
|
|
|
|
Hi,
I've a treeview bound with collections. As the treeview is quite big, it's put inside a div and added scrolling to it. But when i select any node beyond the scrolling capacity, i.e if i select the bottom node, then the Treeview automatically moves to top.
Can anybody give me a solution to this problem.
Thanks in advance.
Vijay
Vijay Mesa
|
|
|
|
|
Hi all,
I have been trying to use Javascript Confirmation Message Box in Asp.Net.
However, I can not get the return value of this message box.
I have tryed the method to add attributes at Page Load using the code like below:
********************
ibtnDelete.Attributes.Add("language", "javascript")
ibtnDelete.Attributes.Add("OnClick", "return confirm('Are you sure you want to delete this record?');")
This will bring up an OK/Cancel box when the button is clicked; if Cancel is then clicked the button's click event code won't run.
********************
But I want, firstly to run the click event of the button, and than according to some calculations
give the user a message asking whether he / she wants to continue??,
if the user says YES --> execute some code
if NO --> execute nothing
Is there a way to solve this problemm??
Thanks to everyone...
|
|
|
|
|
It's difficult mixing javascript confirmation with .cs code. The best bet for what you're trying to do is to use a modalpopupextender and then you have control over the buttons in your code.
|
|
|
|
|
hmmm, how can I use this (modalpopupextender)??
thanks...
|
|
|
|
|
It's part of the ajaxtoolkit.
I'm thinking it might even be better to use the ConfirmButton. Below is the url on how it all works.
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.aspx
|
|
|
|
|
I created updated panel with button when click on button in update panel total page is reloaded,Then What is the use of Updated Panel?
www.funnydotnet.co.cc for dotnet developers
Best Regards
Rajesh Kumar Chekuri
www.rajeshchekuri.co.cc
|
|
|
|
|
The whole ASP.NET AJAX library is there for people who can't be bothered learning how to use AJAX themselves. It works just fine, if your needs are not high traffic or finely grained. I guess you must be doing it wrong.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You need to put a trigger on the update panel so it refreshes the updatepanel when the button is clicked.
<triggers> <asp:asyncpostbacktrigger controlid="NAME OF YOUR BUTTON" eventname="Click" xmlns:asp="#unknown">
|
|
|
|
|
hello
i've getted the following from a site :
private static object ThisLock = new object();
object dataObject = Cache["globalData"];
lock(ThisLock)
{
if( dataObject == null )
{
//Get Data from db
GlobalObj globalObject = GlobalObj.GetData();
Cache["globalData"] = globalObject;
}
}
return globalObject;
but what i need is :
if 2 session access the following code in the same time, does the second wait the first to the locked block and then execute the same code or do not execute the code and pass away from
dghdfghdfghdfghdgh
|
|
|
|
|
I'm not exactly sure about what you are trying to ask, but...
If a thread comes to a lock section that another thread has entered, it will wait until the other thread exits the section.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Does anyone know how to display a web page through a modal popup? I need for it to be dynamic as the web page will be different depending on what the user clicks.
Thanks so much for everyones help.
|
|
|
|
|
Thanks for looking
I know this is not an asp.net question, but someone migh have done this before
Im using googlemaps, when you run it as localhost, the validation key works, no matter the url of the site
I need to test this app from another pc and i access it by the ip 192.168.1.65, the thing is that when i access the page with the map, the map sends me an alert saying the key is not valid
The solution would be to access the site from another computer as localhost, since localhost points to the same computer, i need it to point to 192.168.1.65
I tryed changing the drivers\etc\hosts but it doesnt work, is this even posible??
Thanks in advance
Alexei Rodriguez
|
|
|
|
|
string Code = "select Code from ds1 "
string s;
using (SqlCommand command = new SqlCommand(Code, conn))
{
s = (string)command.ExecuteScalar();
}
string update = " update ds1 set name='asd' where Code='" + s + "'";
In above code give the datatype conversion error. e.g. :
Unable to cast object of type 'System.Int64' to type 'System.String'.
I declared code column as a bigint datatype.
|
|
|
|
|
string update = " update ds1 set name='asd' where Code='" + s.ToString() + "'";
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
As-salam-wa-alaikum!
this gives same error as mentioned above code. error message appeared on
s=(string)command.executescaler();
this line.
|
|
|
|
|
What Datatype is the Field "Code" in the Database?
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|