Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem in sending email to non-local address, say: yahoo email, gmail, etc. But no problem when sending email to local address, say: sending email to myself.

However, I still get an error saying: "Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server."

Please reply me as soon as possible.

with bundle of thanks!
Posted

The error means what it says. Your mail server requires authentication, so, a username and password, to send to a non local address.
 
Share this answer
 
Comments
Muhammad Fahim Baloch 19-Jul-12 4:17am    
but i used required authentication
my code for authentication is

//-------------------------------------------------------------------------------------------
SmtpClient mySmtpClient = new SmtpClient();
System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("tehnical@mydomain.com", "Password");
mySmtpClient.Host = "mail.mydomain.com";
mySmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mySmtpClient.UseDefaultCredentials = false;
mySmtpClient.Credentials = myCredential;

//-------------------------------------------------------------------------------------------
You need to include your Gmail login details when you try to send via them. Have a look at this: Sending an Email in C# with or without attachments: generic routine.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900