|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with .NET 2.0 sending mail with Password by NetworkCredentialarticles/sending_smtp_authenticated_email.aspx) my ISP announce that soon we need to give Authentication for sending EMAIL. I add this code to my App, and I see that Even the Username & Pass is not correct, the email send with no error. I try it with same name & pass on OutlookExpress and I got Error. so it's seem to me that this code not use with Credential that I give? ==================Heare the code 'Create a new MailMessage object and specify the "From" and "To" addresses Dim Email As New System.Net.Mail.MailMessage("Brad.Kings***@orcsweb.com", "B***@KingsleyTeam.com") Email.Subject = "test subject" Email.Body = "this is a test" Dim mailClient As New System.Net.Mail.SmtpClient() 'This object stores the authentication values Dim basicAuthenticationInfo As New System.Net.NetworkCredential("username", "password") 'Put your own, or your ISPs, mail server name on this next line mailClient.Host = "Mail.RemoteMailServer.com" mailClient.UseDefaultCredentials = False mailClient.Credentials = basicAuthenticationInfo mailClient.Send(Email) I check this code with account on Gmail and it's working. the only
change I make for google is to add this line: mailClient.EnableSsl = True So my guessing that .NET check if server request login, and he send the UseDefaultCredentials only if it request by the server. but the Ouotlook express make login anyway. maybe this a reason that Ouotlook express got error when the Password is not correct even server not request login, but .NET send the email withoute error. |
|||||||||||||||||||||||