I strongly suspect authentication is not supported by
System.Net.Mail.SmtpClient at all.
The c# source code found at:
http://www.codeproject.com/csharp/EmailMessage.asp
does the whole smtp protocol communication manually and it works !
(btw, many many thanx to Peter Wone for his _working_ code)
I've tried it with all the same settings as in my original code and relay is
no longer an issue (since I am authenticated of course).
I still can't believe SmtpClient fails to send the AUTH LOGIN smtp command
properly. Anyone got any ideas ?
thanx
"Andreas Schubert" wrote:
hmm, really not sure if this is the right answer, but Outlook has a
mechanism to prevent sending mails through other applicatÃ*ons. However,
there is a registry switch to change this behaviour.
HTH
Andy
"dp" <dp@discussions.microsoft.com> schrieb im Newsbeitrag
news:AD**********************************@microsof t.com... TIP:
According to the server log the outlook succeeds in authentication but the
c# code sends the wrong command and the smtp always responds with message
"SMTPS:S:504 Mechanism not supported".
Maybe this is a lead ?
How the authentication method can be configured in code ?
still, anyone on the original question ?
"dp" wrote:
I am using the following code in .net 2:
MailAddress fromAddress = new MailAddress("valid_smtp_addr", "name");
MailMessage message = new MailMessage();
message.From = fromAddress;
message.To.Add(new MailAddress("so*********@yahoo.com"));
message.Body = Body;
message.Subject = Subject;
message.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("valid_smtp_srv");
smtp.Credentials = new System.Net.NetworkCredential
("valid_smtp_addr", "valid_pwd");
smtp.Send(message);
---
No errors (with the authentication to the smtp server etc etc) but still
all
I get is the "Relay Denied" response.
Outlook express does manage to send the same email through the same smtp
server using the same settings, though !
How is this possible ? What's the difference between outlook and my code
?
thanx