|
Hi
is any method to send email in C# without using SMTP server
KK
|
|
|
|
|
Hi,
try this code....
MailMessage mail = new MailMessage();
mail.From = "hi2udhay@gmail.com";
mail.To = "hi2udhay@gmail.com";
mail.Subject = "Subject";
mail.Body = "Mail Body Here";
SmtpMail.Send(mail);
Udhaya Kumar.D
|
|
|
|
|
Only if you're creating your own email system and deploying servers and clients running it all over the world.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If you are asking about the possibility of sending email without using a SMTP server to relay it - that should be possible. You would need a DNS resolver (like this[^]) that would resolve MX records, so that addresses like yahoo.com get converted to the IP addresses of the SMTP servers. You can then use SMTP to talk directly to the SMTP server.
|
|
|
|
|
How to create object without using NEW keyword
ex:
datatable dt=new datatable();
so,how can i create datatable object without using NEW keyword
|
|
|
|
|
What's wrong with new ?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
In general you can not.
The only exception I know is with constant strings, where "paul" is the equivalent
of new string('p','a','u','l');
You can of course hide the new keyword inside a method (e.g. a CreateInstance) so the caller
does not have to use new, but then that method would include a new.
|
|
|
|
|
Or use reflection
|
|
|
|
|
hello... well i believe u can't create an instance without the new keyword... u can hook onto a an instance without a new keyword but that instance is also created by new...
what i mean is that
datatable dt=ds.tables[0]...Roughly but remember that you are simply assigning ur reference to an object... similar is sqlcommand command=con.createcommand() example...
but this doesn't mean that u are creatin an instance without new keyword...its simply assigning reference to an object that has been created in createcommand method
haseeb
|
|
|
|
|
SwaSubhaVijju wrote: how can i create datatable object without using NEW keyword
Why do you want to do that? What purpose does your request have?
|
|
|
|
|
You can use reflection (MSDN[^]) to do that, but it's a very expensive and roundabout way of doing it.
Like others asked, what's wrong with new ?
|
|
|
|
|
i'm trying to take specific values from xml file into my CheckedListBox but i couldn't make it plz help me
I want to take all the properties(of <tabular>) which have attribut edit = "true" in to my Checkedlistbox
here is my xml file(since i can't desply xml file in the forum i've removed the tags<>)
lasers
laser id="Laser1"
properties
gauge
property name="Output1" min="0" max="100" optimalval="50" currval="0"/property
property name="Output2" min="0" max="100" optimalval="50" currval="0"/property
property name="Output3" min="0" max="100" optimalval="50" currval="0">
<property name="Output5" min="0" max="100" optimalval="50" currval="0">
<property name="Output6" min="0" max="100" optimalval="50" currval="0">
tabular
property name="temperature1" currval="12" edit="true" selected="true" min ="0" max ="100"/property
property name="temperature2" currval="56" edit="false" selected="false" min ="0" max ="100"/property
property name="temperature3" currval="36" edit="true" selected="false" min ="0" max ="100"/property
property name="temperature4" currval="67" edit="false" selected="false" min ="0" max ="100"/property
<property name="temperature5" currval="37" edit="true" selected="true" min="0" max="100">
<property name="temperature6" currval="87" edit="true" selected="true" min="0" max="100">
<property name="temperature7" currval="89" edit="false" selected="false" min="0" max="100">
<property name="temperature8" currval="23" edit="true" selected="false" min="0" max="100">
<property name="temperature9" currval="78" edit="false" selected="false" min="0" max="100">
property name="Avg OutPut" currval="81" edit="true" selected="true" min ="0" max ="100"/property
/tabular
/properties
/laser
-----------
and after this my req is i need to catch the selected values and i wanna desply in a form-----------------this is my req and
i am helpless here, plz try to help me
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
First, you can easily display XML data by checking the "Ignore HTML tags in this message" option beneath the smilies. As this disables all other formatting-options too, you can alternatively replace all < characters with <.
Second, in the bottom right corner of your posting there is a "modify" link that allows you to modify your post (as the name suggest). Please use this link to change a post with which your not comfortable instead of starting new threads. There is also a remove link, so please remove the "duplicate" posts.
Third and regarding your actual question, take a look at the XmlDocument and especially the Load and SelectNodes methods. The documentation of the class, its methods and the continuative links contain many examples that should give you a good starting point.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
You forgot to mention the 'Preview' button when you post a new topic or a reply.
It shows you what your post will look like allowing an oportunity to make changes and correct mistakes/formatting before posting to the forum.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
i'm trying to take specific values from xml file into my CheckedListBox but i couldn't make it plz help me
I want to take all the properties(of <tabular>) which have attribut edit = "true" in to my Checkedlistbox
here is my xml file
lasers
laser id="Laser1"
properties
gauge
property name="Output1" min="0" max="100" optimalval="50" currval="0"/property
property name="Output2" min="0" max="100" optimalval="50" currval="0"/property
property name="Output3" min="0" max="100" optimalval="50" currval="0">
<property name="Output5" min="0" max="100" optimalval="50" currval="0">
<property name="Output6" min="0" max="100" optimalval="50" currval="0">
tabular
property name="temperature1" currval="12" edit="true" selected="true" min ="0" max ="100"/property
property name="temperature2" currval="56" edit="false" selected="false" min ="0" max ="100"/property
property name="temperature3" currval="36" edit="true" selected="false" min ="0" max ="100"/property
property name="temperature4" currval="67" edit="false" selected="false" min ="0" max ="100"/property
<property name="temperature5" currval="37" edit="true" selected="true" min="0" max="100">
<property name="temperature6" currval="87" edit="true" selected="true" min="0" max="100">
<property name="temperature7" currval="89" edit="false" selected="false" min="0" max="100">
<property name="temperature8" currval="23" edit="true" selected="false" min="0" max="100">
<property name="temperature9" currval="78" edit="false" selected="false" min="0" max="100">
property name="Avg OutPut" currval="81" edit="true" selected="true" min ="0" max ="100"/property
/tabular
/properties
/laser
-----------
and after this my req is i need to catch the selected values and i wanna desply in a form-----------------this is my req and
i am helpless here, plz try to help me
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
how to draw listbox items with different itemheight when i select a item?
the example pictures at
http://goldli.s75.53dns.com/2.jpg
http://goldli.s75.53dns.com/1.jpg
I know that use MeasureItem and DrawItem Method to draw,but i can only draw same height items.
|
|
|
|
|
Check this out explains and demonstrates the func. you are looking for.
http://www.codeproject.com/useritems/ExtendedListBoxControl.asp
Hope it helps.
Mike
Started out with nothing and still have most of it left!
|
|
|
|
|
Hi friends,
I am facing a PROBLEM WHILE I send mails with the SMTP class of System.Net.Mail.
The code shows below.
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress("from@domain.com");
mail.To.Add("to@domain.com");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
//send the message
SmtpClient smtp = new SmtpClient("mysmtpserver.net");
//to authenticate we set the username and password properites on the SmtpClient
smtp.Credentials = new System.Net.NetworkCredential("user@domain.com", "password");
smtp.Send(mail);
I have a valid smtp server name, username and password. I configured it to outlook and working fine. And wen I test it using telnet port 25 then also its working.
I upload the file to my hosting space. I have two hosting account with godaddy.
The mailing script is working fine in one hosting account. That hosting account have SSL and dedicated IP address.
But the mailing code is not working in the other hosting account. That hosting account is Windows hosting + ASP.NET 2.0 supported.
The error I am getting is as shown as below.
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.Button1_Click(Object sender, EventArgs e)
Please help me on this issue....
Thanks in advance....
JIJO BABY - Lets Play C#
|
|
|
|
|
Some hosting plans disable any outgoing network traffic from the website, except HTTP. You should make sure that is not the case with your account.
|
|
|
|
|
Hi
I want to have a MS-WORD template and which should be taken as a input to the C# application. I will have some template variables in that template (.dot ) file those should be replaced during run time by the C# object. Please give some sample to work around this.
Thanks.
|
|
|
|
|
Hello everyone,
I am trying to find all methods that have a particular signature. In other words, I want all methods that match the return type and parameter types of a specified method. I have a solution, but I was wondering if a more elegant approach exists. Using delegates is one possibility, but delegates are not very “edit-and-continue” friendly.
Here is my current solution:
void findSimilarMethods()
{
MethodInfo example = this.GetType().GetMethod("ExampleMethod");
ParameterInfo[] parameters = example.GetParameters();
List<MethodInfo> matches = new List<MethodInfo>();
MethodInfo[] methods = this.GetType().GetMethods();
foreach (MethodInfo current in methods) {
ParameterInfo[] currentParams = current.GetParameters();
if ( current.ReturnType != example.ReturnType )
continue;
if ( currentParams.Length != parameters.Length )
continue;
if ( !ParameterEquality(parameters, currentParams) )
continue;
matches.Add(current);
}
}
bool ParameterEquality(ParameterInfo[] a, ParameterInfo[] b)
{
if (a.Length != b.Length)
return false;
for (int i = 0; i < a.Length; i++)
if (a[i].GetType() != b[i].GetType())
return false;
return true;
}
Any suggestions would be greatly appreciated.
-Steve
|
|
|
|
|
Why not use one of the other overloads of GetMethod MSDN[^], like the one that takes the method name and a Type [] for the parameters?
And you don't really need to match return type if you're matching parameter types, because you can't overload methods based on return type alone.
|
|
|
|
|
Why is it that I can declare a constructor in a parent class as protected and then inherent that class and declare a constructor as public in the child class? However if I declare the parent's constructor as private I am unable to create any constructor at all in the child class. Why?
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
It has to do with the accessibility rules in C# and the meanings of private, protected, and public methods.
From the C# Language Reference[^]
- The intuitive meaning of public is "access not limited".
- The intuitive meaning of protected is "access limited to the containing class or types derived from the containing class".
- The intuitive meaning of private is "access limited to the containing type".
When a type or member M is accessed, if M is protected, the access is permitted if it occurs within the class in which M is declared, or if it occurs within a class derived from the class in which M is declared and takes place through the derived class type (Section 3.5.3).
Otherwise, if M is private, the access is permitted if it occurs within the type in which M is declared.
As described in Section 3.4, all members of a base class, except for instance constructors, destructors and static constructors, are inherited by derived types. This includes even private members of a base class. However, the accessibility domain of a private member includes only the program text of the type in which the member is declared.
So, by declaring the constructor as "private", you are limiting it's accessibility to the class in which it is declared (the "containing type"). This effectively tells the compiler that since there is no default constructor accessible from outside the class, any derived classes cannot create an instance of their base class and, therefor, cannot themselves contain constructors.
By declaring the constructor as "protected", you are limiting it's accessibility to the class in which it is declared (the "containing type") and also to any types derived from that class. This effectively tells the compiler that the child classes are able to create an instance of their base class, and, therefor, can also contain constructors.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
The private constructor is intended:
- for classes that doesn't need to be created (provides only static methods)
- for implementing the singleton pattern
Also check out the constructor usage guidelines [^]
Anyway why would you derive a class with private constructor and instantiate that?
|
|
|
|