Authorization Problem
-
I wrote this class:
public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } }
When I run it I have the following problem:An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details.
How do I authorize the account?SnaidiS(Semion)
-
I wrote this class:
public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } }
When I run it I have the following problem:An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details.
How do I authorize the account?SnaidiS(Semion)
-
Semion_N wrote:
How do I authorize the account?
They hide that information in the documentation[^] :rolleyes:
led mike
-
I don't really understand how to use that I write client.Credentials = and then what? for example if my user name is: abcd and password: efg ?
SnaidiS(Semion)
-
string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message);
I'v hilighted the changes, but the problem is still the same...SnaidiS(Semion)
-
I wrote this class:
public class Send_Mail { public void send() { string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); //client.UseDefaultCredentials = true; client.Send(message); } }
When I run it I have the following problem:An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http://www.mail.ru/pages/help/261.html for details.
How do I authorize the account?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"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; 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)
-
OK, Please answer me to the question:
string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; 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.
-
OK, Please answer me to the question:
string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; 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)
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. :-D
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.
-
string to = "snaidis@gmail.com"; string from = "semionn.89@mail.ru"; CredentialCache cache = new CredentialCache(); **cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));** MailMessage message = new MailMessage(from,to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpPermission permission = new SmtpPermission(true); SmtpClient client = new SmtpClient("smtp.mail.ru"); **client.Credentials = cache;** //client.UseDefaultCredentials = true; client.Send(message);
I'v hilighted the changes, but the problem is still the same...SnaidiS(Semion)
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.