|
hi there,
if you want to send emails to any mailserver then you have to use a namespace called
System.Web.Mail.
After that you can use SmtpMail Class which contain a static method called SmtpMail.Send().
You can overload this method in two different ways.
1. You can directly pass required parameter for sending mails in that Smtp.Send() method.
Eg.
string from="Yourname@hotmail.com",to="qqq@hotmail.com",subject="hi hi",message="ha ha ha";
SmtpMail.Send(from,to,sunject,message);
//this line of code will send mail to your friend.
Here we won't get that much flexibility to compose our message part. If you want to use nicely formated body and message part. then you need to go for the second fasion(next example).
2. use MailMessage class to create mail.
eg. MailMessage Msg=new MailMessage()
After creating object of MailMessage class you are absolutly free to give what ever modification that you wan.
Please check the members avilable in our Msg object. All are self explanatory
and then use
Smtp.Send(Msg)
Bfore sending mails don't forget to give your Smtpmailserver name.
eg:
SmtpMail.SmtpServer="YourSmtpServerName";
bye
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
1. Using System.Web.Mail.SmtpMail is not a good idea. It relies on CDO which is provided by Microsoft Exchange, Outlook XP and above (maybe 2000, but I don't remember), and Microsoft Virtual SMTP Server, all of which may or may not be installed. The best way is to write a simple SMTP client yourself which is very easy for composing basic mail messages and sending them. We've covered this in this forum before, so try a search.
2. Hotmail doesn't expose SMTP services. It uses HTTPMail, a proprietary protocol. If you're trying to send mail through Hotmail, you must use this protocol. Read Hotmail using C# – A HTTPMail client under .NET[^] for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hello everybody.
i wnat to close the form automatically after a specific time ,say "10 seconds".
please help me..
thanks 4 u all.
|
|
|
|
|
Create a Timer on the form and set the interval to 10 seconds. Create an event handler that will close the form when the timer's event fires.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Just don't forget to enable the timer, it defaults to disabled.
I spent a while trying to figure out why my timer event's were not firing the first time i used one!
DOH!!
Kev Pearman MCP
|
|
|
|
|
hi,
How can i change the backcolor of tab control including their caption part(all different tabs in that tab control).
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I found out my self. So i am not expecting any answers.
thanks
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
I found out my self. So i am not expecting any answers.
Maybe someone else is. Maybe someone with a similar problem read your query this morning and thought "That sounds like the problem I'm having. I'll have a look again later and see if anyone else replied." So, now that person is disappointed because you know the answer but didn't tell anyone.
Good etiquette would dictate that you should tell the rest of us the answer to help educate us all - even those who were not seeking the answer to your question may find something useful after all.
Now, what's is the answer to the question, o' great wise one?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
That's funny - thinking that someone would actually try searching this forum before posting a question for the "umpteenth" time.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I live in eternal hope.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
HI,
Actually i post this above question yesterday.See my habbit is i won't sit and wait for answer. if i don't know any concept i will post my queary here in codeprooject and simultaniously i will try my leval best to figure it out.
That's why i wrote that " I got answer and not expecting answers....
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
See my habbit is i won't sit and wait for answer. if i don't know any concept i will post my queary here in codeprooject and simultaniously i will try my leval best to figure it out
That is very commendable, however that was not the reason for my post. The reason for my post was that you announced to the world that you knew the answer, but you did not tell the world the answer. You kept the answer to yourself. CodeProject is for sharing information.
It is good manners, if you find the answer to the question you asked, to tell everyone that (1) you found it [which you did] and (2) what the answer is [which you did not].
So, I repeat: What is the answer to your original question?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Who is going to draw ?
Tabcontrol have a properties called DrawMode. This will set or get the value that whether user or system will paint the caption.By default it is normal. Means system(OS) will paint the caption for you. If you(parent form) want to draw the caption you have to set the value of the property to OwnerDrawFixed.
You can mention DrawMode on design time or runtime like below mentioned code.
this.tabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
Now you mention who is going to draw the caption.
Next thing is how is going draw ?
Tab control have an event called DrawItem event which will occure when ever an area need to be painted.
eg:
this.tabControl1.DrawItem += new DrawItemEventHandler(this.tabControl1_DrawItem);
private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
Font f;
Brush backBrush;
Brush foreBrush;
if(e.Index == this.tabControl1.SelectedIndex)
{
f = new Font(e.Font, FontStyle.Bold | FontStyle.Bold);
backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Blue, Color.Gold, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
foreBrush = Brushes.White;
}
else
{
f = e.Font;
backBrush = new SolidBrush(e.BackColor);
foreBrush = new SolidBrush(e.ForeColor);
}
string tabName = this.tabControl1.TabPages[e.Index].Text;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
e.Graphics.FillRectangle(backBrush, e.Bounds);
Rectangle r = e.Bounds;
r = new Rectangle(r.X, r.Y + 3, r.Width, r.Height - 3);
e.Graphics.DrawString(tabName, f, foreBrush, r, sf);
sf.Dispose();
if(e.Index == this.tabControl1.SelectedIndex)
{
f.Dispose();
backBrush.Dispose();
}
else
{
backBrush.Dispose();
foreBrush.Dispose();
}
}
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi Colin Angus Mackay ,
I am really sorry for this late posting of my answer. I want this sort of suggections in future also. ;P
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi,
I have a c# console app that periodically look at one directory to see if any new folders have been uploaded there. If it finds a new folder it should move this folder to a different folder. This works fine my problem is that it moves this folder with the old permissions. Is there any way that I can change the owner of this folder to be set to its new parent folder? I have had a look at activeDs but I just can't seem to delete the existing permissions I can however add new permissions.
Any help would be greatly appreciated.
Thanks in advance.
Gavin Jeffrey
|
|
|
|
|
See http://weblogs.asp.net/cumpsd/archive/2004/02/08/69403.aspx[^] and follow the link to the GotDotNet sample, which is written by Microsoft and will be included (in some form) in the upcoming .NET 2.0 release.
Also keep in mind that you must have (or rather, your application) the right permissions to make changes you requested, otherwise what would be the point of file security?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
great it works. Thanks for the help.
|
|
|
|
|
Hello everyone.
I've been trying to find a way of figuring out how to know which method called another method.
For now I'm using the MethodInfo MethodBase Object and passing it as a parameter to the called method but is there a better way of doing it? I know that you can find out who the calling assembly is, but how do I find out the name of the method that made the call?
Thanks for any help.
|
|
|
|
|
Look at my post regarding exactly how to do this, a few posts down (i think yesterday or the day before), on how to use StackTrace. From there u can get the MethodBase just as you want it, but be warned, it will likely be much slower than passing MethodBase.Current. Anyways, I dont find anything wrong with your approach as long as you keep those ugly ones private!
top secret xacc-ide 0.0.1
|
|
|
|
|
Thanks for your reply, I'll look into your suggestion.
I don't see anything wrong with it either other than I'm lazy and don't want to have to create the methodbase object from each of the methods that calls that particular method, I'd rather have the called method figure it out.
Again, thanks for your help.
|
|
|
|
|
Hi Friends
I have a console application that produce assembly in .EXE. This app has some dependency assemblies which it reference in the project.
Now i want to give my client only the .EXE file. So i want to statically link the dependency assemblies in this .EXE .
The Assembly Linker tool(al.exe) only links the modules or the resource files.
Any pointer and idea is most welcome.
Thanx a lot
Naveen
|
|
|
|
|
Static linking is not supported by the .NET framework. True, you can combined a few assemblies, but its purely a hack, not static linking in the true sense. .NET is designed around dynamic assemblies that are self-describing.
top secret xacc-ide 0.0.1
|
|
|
|
|
hi leppie
Thanx for info.
Yes my main requirement is to combine few assemblies into one main assembly(.EXE) nad just give my client the .EXE file.
If you the solution or any idea ,please do let me know
Thanx a lot
Naveen
|
|
|
|
|
softp_vc wrote:
Yes my main requirement is to combine few assemblies into one main assembly
I am curious. Why? What is wrong with distributing a few assemblies? If this was really an important requirement why didn't you build it as one exe in the first place?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Hi
you are right at your place.
But right now my concern is to link the dependent assembly into the main assembly file.
Hope any body would be having the idea for this
Regards,
Naveen
|
|
|
|