Posted on 2007-10-04
i'm trying to send mail to email address outside of the domain and i'm using the System.Net.Mail objects (not system.web). at first, i just tried a straight up send using the address of my exchange server as the smtp host, but i got relay errors for any addresses that were outside the domain. so i found somewhere that i could use SmtpDeliveryMethod.PickupDirectoryFromIis to get around this problem, but then i got Cannot get IIS pickup directory. so i figured it was because my exchange server did not have the smtp in IIS (it's in exchange and it's separate). so i installed smtp on the web host and configured it with the proper permissions, but now the emails just don't get sent and i don't get any errors.
Dim objMail As New MailMessage()
objMail.From = New MailAddress("email@example.com")
objMail.Subject = "This is an email"
objMail.Body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>"
objMail.IsBodyHtml = True
Dim smtp As New SmtpClient("192.168.1.8") 'the localhost
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis