|
The following worked for my ISP. mail.bellsouth.net and 25 are the SMTP server name and outgoing port number respectively.
private void btnTestEmail_Click(object sender, EventArgs e)
{
try
{
using (MailMessage message = new MailMessage(myEmail, myEmail, "subject1", "body1"))
{
SmtpClient mailClient = new SmtpClient("mail.bellsouth.net");
mailClient.UseDefaultCredentials = false;
CredentialCache myCache = new CredentialCache();
myCache.Add("mail.bellsouth.net", 25, "Basic", new NetworkCredential(myUserName, myPassword));
mailClient.Credentials = myCache;
mailClient.Send(message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Good Luck.
|
|
|
|
|
Do you know any SMTP servers which doesn't require authorization?
SnaidiS(Semion)
|
|
|
|
|
They've been all but gone from the net for years spammers would find and abuse them and the owner would have to implement authorization to get off blacklists.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
OK, Please answer me to the question:
string to = "snaidis@gmail.com";<br />
string from = "semionn.89@mail.ru";<br />
CredentialCache cache = new CredentialCache();<br />
cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));<br />
MailMessage message = new MailMessage(from,to);<br />
message.Subject = "Using the new SMTP client.";<br />
message.Body = @"Using this new feature, you can send an e-mail message from an application very easily.";<br />
SmtpPermission permission = new SmtpPermission(true);<br />
SmtpClient client = new SmtpClient("smtp.mail.ru");<br />
client.Credentials = cache;<br />
client.Send(message);
I'v hilighted the changes, but the problem is still the same...
-- modified at 15:12 Friday 19th January, 2007
SnaidiS(Semion)
SnaidiS(Semion)
|
|
|
|
|
Since UseDefaultCredentials defaults to true, perhaps you just need to explicitly set if false.
|
|
|
|
|
Have you replaced "MyAcc" "MyPass" with the user name and password for your account on the email server? Your user name is probably "semionn.89", I can't tell you what your password is.
Semion_N wrote: cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Can one XML file hold more than one C# object?
Say 2 or 3 ArrayLists?
I have more few questions regarding this, but this is basic question to make sense to others I have...
|
|
|
|
|
If you mean using Serialization, Yes.
led mike
|
|
|
|
|
OK on simple example, I know how to do it with one object
say something like this is done:<br />
XmlSerializer ser = new XmlSerializer(typeof(ArrayList), new Type[] { typeof(SomeClass) });<br />
XmlTextWriter writ = new XmlTextWriter("List.xml", System.Text.Encoding.UTF8);<br />
ser.Serialize(writ, SomeList);<br />
writ.Close();
Can you show me example, loading for example two ArrayLists each hold diferent type of data...
|
|
|
|
|
Any idea, i figured out i can make one more arraylist and put anything I want in XML in it... and done... but is there more elegant solution?
|
|
|
|
|
I use F12 (right mouse click, GoToDefinition) to go to the Definition of a function.
What key can be used to go back to the source please?
Thanks
|
|
|
|
|
Well, if the definition is in a different source file, Ctrl+Tab will take you back. If it's in the same source file, set a bookmark first. There might be a keystroke to return you to your previous location, but I'm not aware of one.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
CTRL/- goes to previous location ("navigate backward")
and CTRL/SHIFT/- is "navigate forward"
There are buttons for them on the "View" toolbar
Such buttons can show tooltip including shortcut
(enable thru Tools/Customize/Toolbars/Show ScreenTips on toolbars)
Luc Pattyn
|
|
|
|
|
Luc Pattyn wrote: CTRL/- goes to previous location ("navigate backward")
and CTRL/SHIFT/- is "navigate forward"
Very cool! I'd tried a few keywords in the keyboard customization to see if anything came up, but "navigate" wasn't one of them.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
I am needing to find out the current CPU usage to determine if I need to run a service or not. If the computer is currently busy then I would like to pause my win-services for x-amount of time and then run it again so users don’t feel the repercussions of my programming and vice versa.
In the Task Manager (at the bottom status bar) we can see the # of processes, CPU Usage etc. How I can get/calculate that? Are there any classes available?
Thanks in advance.
|
|
|
|
|
Have a look at System.Diagnostics.PerformanceCounter .
If you want to run a process that does not degrade the performance, you can start a thread with the Priority property set to BelowNormal .
---
Year happy = new Year(2007);
|
|
|
|
|
This link[^] should help.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Thanks a lot
|
|
|
|
|
Microsoft lists System.Object as a reference type but how a value type like int or bool descends from System.Object?
There's arms,
Caetano
|
|
|
|
|
This link[^] should help explain the matter. It's a good read actually!
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
I'd like to completely prevent the "...has encountered a problem and needs to close. We are sorry for the inconvenience" dialog and handle the error internally.
Without using try-catch.
This is multithreaded console app. I've tried hooking Application.ThreadException, Application.SetUnhandledExceptionMode, and AppDomain.CurrentDomain.UnhandledException. Unless I'm doing something wrong, those don't prevent the dialog from appearing.
Any ideas?
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Marc Clifton wrote: Without using try-catch
Just currious but ... why?
led mike
|
|
|
|
|
Argh. I just hit the ESC key and wiped my entire reply.
The short of it is that I'm experiencing this dialog even though the entire Main is wrapped with a try-catch block. It occurs when I'm using DirectX / DirectShowLib when playing a bad DVD. But it's hard to reproduce.
Turning the question around, I'm wondering if it's possible to prevent the catch from working. The DirectShowLib code has this interesting error handler:
Marshal.ThrowExceptionForHR(hr);
Also, I'm wondering if there's a thread (not created by me) that is throwing an exception. However, I thought thread exceptions were usually silent.
So, that's why I asked. Because it appears to be occurring with something not in my control.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Perhaps the Application.XXXX exception mechanisms rely on a GUI thread or WinForms framework which you don't have.
Have you tried reproducing the behavior from a WinForms application?
led mike
|
|
|
|
|
led mike wrote: Perhaps the Application.XXXX exception mechanisms rely on a GUI thread or WinForms framework which you don't have.
I was worried about that.
led mike wrote: Have you tried reproducing the behavior from a WinForms application?
Not yet. It's on the list of things to try. But first I want to figure out how to consistently, with a test jig, create the problem.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|