I have a piece of code that sends email.. heres the code
This is not working for me. This a remote smtp service ... and i double checked that email web access works fine .. i can login using the gui, recieve and send emails.
But when i try to do it through code .. it fails with the message ...
{System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 No AUTH command has been given.
Can anybody advise ... and also they dont have EWS exposed ie.e exchange web service ./.. this is the way to go ..
port is 25 and no SSL or TLS
Button b = sender as Button;
try
{
MailMessage msg = new MailMessage(senderEmail, recieverEmail, "afdasfas", "safasfa");
//MailMessage msg = new MailMessage(senderEmail, recieverEmail, subject, subject);
System.Net.Mail.SmtpClient mailclient = new System.Net.Mail.SmtpClient(EmailSmtpServer, outgoingPort);
System.Net.NetworkCredential auth = new System.Net.NetworkCredential(senderEmail, senderPassword);
mailclient.Host = EmailSmtpServer;
mailclient.UseDefaultCredentials = false;
mailclient.Credentials = auth;
mailclient.Send(msg);
MessageBox.Show(b.Content + ":WORKED");
}
catch (Exception e4)
{
MessageBox.Show(b.Content + ": " +e4.Message);
MessageBox.Show(b.Content + ": " + e4.StackTrace);
}