Dim MailClient As New System.Net.Mail.SmtpClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.MailClient.Host = "xxxx.xxx"
Me.MailClient.Port = "25"
Dim MyCred As New System.Net.NetworkCredential("[email protected]", "xxxxxxx")
MailClient.UseDefaultCredentials = False
MailClient.Credentials = MyCred
MailClient.Send("[email protected]", "[email protected]", "[Test]- VB App", "VB App")
End Sub
Now, when I try to send an email to a email address on the mailserver, it works fine. But when trying to send to for example, a Gmail or Yahoo account, it will not - says 'Cannot Relay'. Yes, the user I'm authenticating with does have permission to relay....
Thanks!
Brandon
Scott LyslePosted Oct 28, 2006, 11:14 PM
Just to be clear, on your local instance of IIS, have you set the smart host property to point to this mail server (right click the Default SMTP Virtual Server icon, select properties, select the Deliver tab, then click the "Advanced" button to show the dialog). You did not mention this in your posting so I wanted to ask that first.
Scott Lysle